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?

Regardless of the answer above I'd like to make a recommendation that a 'Public Domain Content' checkbox be added for answers. Since I may pull code from an already public domain source the license does not apply anyway.


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.

  • 1
    "Public domain" is legally questionable in some countries. IANAL, but I thought copyright/CC fit into more countries legal systems than PD. Commented Oct 15, 2009 at 4:01
  • 2
    License mess?! Everything is CC-BY-SA. Isn't that clear enough?
    – mmx
    Commented Oct 15, 2009 at 7:57
  • 18
    CC-BY-SA is horribly restrictive and only slightly less worse than the GPL!! It should be Public Domain or BSDL only. Commented Jan 18, 2012 at 18:42
  • 8
    "License Free" isn't an option. It would equal granting no specific rights to anybody.
    – Kos
    Commented Jan 7, 2014 at 15:29
  • 1
    The license that's closest to what you want ("License Free") is the Unlicense.
    – bukzor
    Commented Mar 10, 2014 at 18:10
  • 2
    +1 for adding an "unlicense" checkbox on answers. That would alleviate a lot of my concerns. Commented Mar 12, 2014 at 19:16
  • 2
    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 Commented Dec 20, 2015 at 23:08

5 Answers 5


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:

user contributed content licensed under cc-wiki with attribution required

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.

  • 36
    All your code are belong to us?
    – alex
    Commented Oct 15, 2009 at 4:46
  • 37
    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
    Commented Oct 15, 2009 at 19:00
  • 23
    This answer is wrong, and should be revised. Fair use doctrine does not apply to embedding excerpts of copyrighted work into source code. Commented Mar 17, 2013 at 4:28
  • 15
    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
    Commented Nov 30, 2013 at 17:18
  • 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
    Commented Mar 10, 2014 at 18:32
  • 9
    Full marks, @NickAldwin. This isn't paranoia. This is for real. People take other people to court over stuff like this. Commented Mar 12, 2014 at 19:17
  • 1
    @djhaskin987 interesting, can you show us any examples of this happening? URLs? Commented Mar 13, 2014 at 7:11
  • 9
    @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
    Commented Apr 4, 2014 at 18:16
  • 1
    @JRaymond no examples, then? Interesting. Fear, uncertainty, and doubt.. Commented Apr 6, 2014 at 6:56
  • 6
    @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
    Commented Apr 7, 2014 at 16:23
  • 2
    "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
    Commented May 12, 2014 at 0:17
  • 3
    BEWARE: meta.stackoverflow.com/a/288713/52551 Commented Mar 25, 2015 at 18:51
  • 2
    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
    Commented Dec 17, 2015 at 9:44
  • 1
    @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
    Commented Jan 4, 2016 at 16:17
  • 3
    Very unprofessional, this answer requires an update. Moderators? Commented Jan 30, 2017 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.

  • 2
    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
    Commented Oct 15, 2009 at 14:53
  • 19
    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. Commented Oct 15, 2009 at 15:48
  • 1
    BSD still requires attribution, which can be icky. The absolutely permissive license is the Unlicense.
    – bukzor
    Commented Mar 10, 2014 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
    Commented Mar 10, 2014 at 18:50
  • MIT is OK. Anything else means to see the idea and then write your own code in too many cases. Commented Jun 9, 2014 at 21:13
  • 2
    @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
    Commented Feb 20, 2015 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
    Commented Feb 21, 2015 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
    Commented Feb 21, 2015 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:

  1. Read the answer.
  2. Understand the answer.
  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.

  • 7
    ..include a link to the answer asking them to up vote it :)
    – Amarghosh
    Commented Oct 15, 2009 at 13:52
  • @Greg, He's likely talking about SE in general, not just SO. Looking at you codereview.SE
    – Pacerier
    Commented Apr 12, 2015 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. Commented Apr 12, 2015 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
    Commented Apr 12, 2015 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.

(This answer is licensed under both CC0 and WTFPL.)


See Re-using ideas or small pieces of code from stackoverflow.com also.

Furthermore, in regards "fair use", see http://en.wikipedia.org/wiki/Fair_use#Fair_use_under_United_States_law and some other interesting documents from the Australian government: http://www.copyright.org.au/find-an-answer/browse-by-letter/i/page-1/ - in Australia the term is not "fair use" but "fair dealing" btw: http://en.wikipedia.org/wiki/Fair_dealing#Australia

  • 1
    A “fair use” concept does not exist in many countries; the highest German court, for example, has recently ruled on direct quotes and limited them massively (to the effect that there definitely is not something like “fair use” in Germany). That's why I added a blurb into my SO profile dual-licencing my content and urge everyone else to do so, too.
    – mirabilos
    Commented Sep 17, 2013 at 18:12

Not the answer you're looking for? Browse other questions tagged .