# What is up with the source code license on Stack Overflow? [duplicate]

I know this has been asked several times. I've read the responses. I'm still very confused.

What are the legal requirements for using samples from SO in other projects? If there are requirements, how should we go about removing them?

Case in point: a user whose question I answered was concerned about the CC license. I had to email him the solution to remove his fears of licensing. That's stupid, I don't want to give out my email address to work around legal issues.

So can someone at this organization clarify this is the intent? If so, what is a legally sufficient means of bypassing the license? One related answer suggested a profile message that source posted would be considered public domain and free of licensing. Is this sufficient?

UPDATE

http://creativecommons.org/licenses/by-sa/2.5/ actually clears it up a little, my apologies for being a twit and not finding this first. Most of my confusion comes from this question where the basic consensus among answers was to 'consult an attorney' which is IMO counterproductive.

PS: I still think a "License Free" option for posts would be an ideal solution.

• "Public domain" is legally questionable in some countries. IANAL, but I thought copyright/CC fit into more countries legal systems than PD. – Craig Stuntz Oct 15 '09 at 4:01
• License mess?! Everything is CC-BY-SA. Isn't that clear enough? – mmx Oct 15 '09 at 7:57
• CC-BY-SA is horribly restrictive and only slightly less worse than the GPL!! It should be Public Domain or BSDL only. – Theodore R. Smith Jan 18 '12 at 18:42
• "License Free" isn't an option. It would equal granting no specific rights to anybody. – Kos Jan 7 '14 at 15:29
• The license that's closest to what you want ("License Free") is the Unlicense. – bukzor Mar 10 '14 at 18:10
• +1 for adding an "unlicense" checkbox on answers. That would alleviate a lot of my concerns. – djhaskin987 Mar 12 '14 at 19:16
• For someone coming across these comments later, CC0 accomplishes the same goals as the Unlicense in a more robust and thorough way. I don't think there's actually any situation where the Unlicense is the best choice. You can check out the GNU analysis: gnu.org/licenses/license-list.en.html#Unlicense – GrandOpener Dec 20 '15 at 23:08

I had to email him the solution to remove his fears of licensing

Maybe he's afraid of the monsters under his or her bed, too? Is this one user representative of the majority? Or any sizable contingent of the audience?

It's not a license mess, some people are a mess.

The footer says:

The cc-wiki license seems pretty clear to me on this point: free to remix and reuse, as long as you attribute and use a similar license.

That said, a snippet of code falls under excerpt category and thus should be free to use under fair use. Heck, we don't even support giant masses of code being posted, so to me, by definition, everything would be an excerpt. We're not sourceforge, github, or codeplex.

I am not sure this is really a practical ongoing concern except for the truly paranoid.

Of course, just because you're not paranoid doesn't mean they're not out to get ... your code.

• All your code are belong to us? – alex Oct 15 '09 at 4:46
• What if said user wanted to incorporate the code into a commercial application? The cc-wiki license doesn't have exemptions for small snippets--thus the possibility exists of a lawsuit. – NickAldwin Oct 15 '09 at 19:00
• This answer is wrong, and should be revised. Fair use doctrine does not apply to embedding excerpts of copyrighted work into source code. – Geoff Oxberry Mar 17 '13 at 4:28
• Even the Creative Commons suggests you shouldn't use CC for code. SO should probably start building out something now to ask posters if they don't mind dual licensing to avoid anyone telling a lawyer "But Jeff Atwood told me..." ;) Then you can mark legacy un-dual licensed answers with a quick warning. What a mess. – ruffin Nov 30 '13 at 17:18
• Jeff: The question is about removing the copy-left requirements of the CC-BY-SA. Corporate management and even open-source project leaders have a duty to be paranoid about legal troubles. The answer to Do I have to worry about copyright issues for code posted on Stack Overflow? is, in essence, "yes". – bukzor Mar 10 '14 at 18:32
• Full marks, @NickAldwin. This isn't paranoia. This is for real. People take other people to court over stuff like this. – djhaskin987 Mar 12 '14 at 19:17
• @djhaskin987 interesting, can you show us any examples of this happening? URLs? – Jeff Atwood Mar 13 '14 at 7:11
• @JeffAtwood Corporate lawyers are, by nature, paranoid - just because nobody HAS done so doesn't mean it can't happen. And to the aforementioned corporate attourney "We can't be sued" is the only acceptable answer - "It's very unlikely that we would be sued" doesn't cut it – JRaymond Apr 4 '14 at 18:16
• @JRaymond no examples, then? Interesting. Fear, uncertainty, and doubt.. – Jeff Atwood Apr 6 '14 at 6:56
• @JeffAtwood such is the joy of working at an "Old Guard" company - Culture change is nigh to impossible and the strictures are many. Unfortunately this makes things difficult for the lowly developer who just wants to use a code snippet – JRaymond Apr 7 '14 at 16:23
• "everything would be an excerpt": While this might be true for most (?) posts on SO, this is not the case for sites like Code Review (which might include the full source code of small programs). – unor May 12 '14 at 0:17
• – Spencer Ruport Mar 25 '15 at 18:51
• Re. excerpts, Google lost vs. Oracle over (among other things) a 9-line method... I'd be wary to follow your advice if I were working on closed source code... – assylias Dec 17 '15 at 9:44
• @ruffin, sorry, I should have made my context clear. I was responding to your remark that "Even the Creative Commons suggests you shouldn't use CC for code." The explicit compatibility w/GPLv3 means that remark is now moot. Furthermore, as SE posts often integrate code & other content such that the line between the two is unclear, CC-BY-SA 3.0 (or 4.0) is a great license to use by default, because [1] "code" parts can then be licensed under GPL, which is one of the CC corp's recommended software license, & [2] it leaves users free to dual-license under MIT/etc if they wish to (as you do). – user136089 Jan 4 '16 at 16:17
• Very unprofessional, this answer requires an update. Moderators? – PascalVKooten Jan 30 '17 at 23:18

CC-BY-SA is not an all-permissive license like the modern BSD type. It's much closer to the GPL, in that derivations have to be under a share-alike license.

For some programmers, this is fine. I work on internal software, so it really doesn't matter what Free/Open Source licenses we use. All we need is permission to use, modify, and distribute internally, and that's what we do.

On the other hand, some of us make money by selling software in the traditional sense, and CC-BY-SA isn't compatible with that business model. (I've had a couple of jobs like that.) Some of us work for companies with lawyers or managers who don't "get" free/open source software. (I've had some clueless managers.) In this case, anything short of a BSD-type license might frighten them.

Nor does the "excerpt" idea necessarily help. There is, as far as I know, no official lower bound of what is copyrightable, and there is not necessarily a right to use excerpts. In the US, "fair use" is in the copyright law, but again there's no actual definition: it's a judgment call that should consider several things. There's legal dangers with rewriting snippets also, in that it isn't clear what's a derivative work. All of these would potentially have to be decided in a court of law, and that's expensive.

So, there is a very real problem for individuals or companies that sell proprietary software and don't want to be in the position of having to defend what they include in court.

I think it would help if we had a handy BSD-type license we could slap onto code snippets as we wished.

• It could be argued that an excerpt is a small amount of code that is showing a concept, which means that it's enough of a common structure as not to be either patentable nor copyrighted. You can't copyright the opening Dear sir or maddame, for the same reason. I'm still waiting someone to patent for(;;){} – perbert Oct 15 '09 at 14:53
• However, "it could be argued" is not good enough for a lawsuit-averse company, since the place where it would be argued is a courtroom. There's a saying that the only thing worse than winning a lawsuit is losing one. Much better to make sure everything is legally clear without resorting to anything subjective that could wind up in court. – David Thornley Oct 15 '09 at 15:48
• BSD still requires attribution, which can be icky. The absolutely permissive license is the Unlicense. – bukzor Mar 10 '14 at 18:37
• You'll likely be interested to know: Fair use doctrine does not apply to embedding excerpts of copyrighted work into source code.. – bukzor Mar 10 '14 at 18:50
• MIT is OK. Anything else means to see the idea and then write your own code in too many cases. – akostadinov Jun 9 '14 at 21:13
• @bukzor says one random unqualified dude, citing his own logically questionable interpretation of statute and not offering any supporting case law. I'll care when he shows us where his legal theory has been tested in court. – Mark Amery Feb 20 '15 at 22:31
• @MarkAmery: Yea... I've changed my stance on the unlicense. It's a crayon license. The ISC license is the best we've done so far, but I still wish we had an MIT-like that didn't require attribution. – bukzor Feb 21 '15 at 0:12
• @bukzor just to clarify, my response above was to your comment about fair use as it applies to source code. I honestly hadn't noticed that you were the author of another comment here as well. – Mark Amery Feb 21 '15 at 0:14

Stack Overflow answers simply aren't big enough to be concerned about licensing. Here's how you (I'm using the general "you" here) can deal with it:

3. Implement a corresponding solution in your own words code.

Or, if you would prefer to copy the code verbatim and comply with the cc-wiki license, include a link to the answer in a comment in your source code.

• ..include a link to the answer asking them to up vote it :) – Amarghosh Oct 15 '09 at 13:52
• @Greg, He's likely talking about SE in general, not just SO. Looking at you codereview.SE – Pacerier Apr 12 '15 at 13:07
• @Pacerier: The question quite clearly asks about source code posted on Stack Overflow. Besides, this question was asked long before any Stack Exchange programming sites other than Stack Overflow existed. – Greg Hewgill Apr 12 '15 at 17:11
• @GregHewgill, Ic. But this thread seems to be linked from alot of other SE sites and being taken as "general SE advice". – Pacerier Apr 12 '15 at 18:26

Anything you produce, you own the copyright to. You can release that to the public under whichever license(s) you wish. (Note the plural.) By posting it on SO, you release it under the CC-BY-SA 3.0 license. There's nothing stopping you also releasing it under CC0 or WTFPL (or both).

Wikipedia has a template for “public domain” images: PD-Self:

I, the copyright holder of this work, release this work into the public domain. This applies worldwide. In some countries this may not be legally possible; if so: I grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.

This seems reasonable. And I don’t see why you’d need to host it elsewhere, or send it over e-mail, to put such a license on it. There’s nothing stopping you putting some code here with a comment at the top:

// License: WTFPL (http://www.wtfpl.net)


That'd be sufficient.