Strongly related: Do I have to worry about copyright issues for code posted on Stack Overflow?

It appears that all the submitted content on Stack Overflow is licensed under the Creative Commons (CC) license Attribution-ShareAlike 3.0 Unported.

What I read from that, Stack Overflow owns all the content on the site. Everybody can use any code on SO as long as Stack Overflow is attributed.

This worries me for developing proprietary software, because now the app is not fully owned by my company anymore (and pieces are just licensed off SO). Our legal guys are probably not going to be happy with that.

If I were to ask questions about my open source project, this also implies I now need to put all my OS projects under the same license. I like BSD, and these two are not exactly compatible.

I'd like to see all the questions and answers be placed under the public domain. I feel most people on SO already treat it as such, especially the ones developing proprietary software. I think it's in everybodies interest to also make this very clear on the site.

  • 14
    Don't worry, be happy. And don't copy code from the internet. codinghorror.com/blog/archives/001268.html – jjnguy Jul 8 '09 at 18:34
  • 3
    I'm worried that apes will become our masters. – cletus Jul 9 '09 at 5:27
  • I'd love to hear what Jeff has to say about this... – Paolo Bergantino Jul 9 '09 at 5:28
  • 2
    Please see this question regarding the copyright issue, where Jeff appears to say that Evert is incorrect about ownership: meta.stackexchange.com/questions/13976/… – chaos Aug 16 '09 at 17:28
  • 4
    I'm so worried about the baggage retrieval system they've got at Heathrow. – waffles Aug 16 '09 at 22:55
  • 8
    You should be worried. The owners of StackOverflow don't understand anything about copyright law. – Instance Hunter Mar 2 '10 at 16:10
  • 2
    As @chaos says, Stack Exchange does not own or hold the copyright to our contributions; we own them and license them to Stack Exchange. See section 3 of the ToS. (That does not necessarily mean there's nothing to worry about, of course.) – Eliah Kagan Feb 17 '13 at 16:27
  • I would think that the user who authored the answer remains the owner of the relevant IP, not Stack Exchange. By posting the answer, the author agrees to license it (to Stack Exchange and to everyone else) under CC-SA at least (I assume the owner is also free to multi-license with other equally permissive licenses if they like) so that SE can display it on their site(s). However, that does not cause SE to become the owner of the IP itself. Though as with any permissively licensed thing, the question of "who is the owner?" is largely moot. – aroth Apr 28 '14 at 4:42

Here's a novel-addition... LEARN from Stack Overflow. Don't copy the solutions, learn the solutions. Even if your implementation of what YOU LEARNED is similar to the examples from which you studied, all is well.

You'll be legal, safer, and smarter in the end.

  • 4
    That's something I can definitely do (and have been doing most of the time). Do you feel that this is something that should be stated on SO as a firm warning, or do you feel it's completely unneeded? – Evert Jul 8 '09 at 19:08
  • 1
    Good question. Even if it were stated, I don't think it will stop people from copy/pasting their way through personal work. – Sampson Jul 8 '09 at 19:10
  • 8
    Give me teh codez!!111! (or you wont get my upvote) – Tom Hawtin - tackline Jul 8 '09 at 19:20
  • 12
    (-1) We always encourage people to use code snippets. So, the question is, can I embed those code snippet in my app? You answer side-steps that in a way that sounds clever. Except when you say "I need to code X" and "X" is sitting (fully functional) on SO, they Don't Reinvent The Wheel, would tell you to USE THAT CODE. This question is about the legal applications of doing that. – devinb Jul 28 '09 at 12:31
  • @devinb - No, I'm asking the readers to learn, not merely copy. If you want to use a working bit, fine, but learn why it works. – Sampson Jul 28 '09 at 12:56
  • 6
    @Jonathan, Okay, so lets assume that I've learned why it works. Can I THEN use it in code? And what are the legal ramifications of that? Those questions still stand. Someone can do everything you say and be exactly where they started when it comes to this question. Your answer is simply a tangent to the question. – devinb Jul 28 '09 at 13:04
  • 3
    My point is that if you learn from it, you've got nothing to worry about. I cannot prove that you stole $var = "foo" . "bar"; from me. So there's no point in stressing over whether or not I should be glorified with a comment in your documentation. – Sampson Jul 28 '09 at 13:40
  • 1
    Of course you should learn, but the most correct and obvious step then is to paste the code snippet into your code. (Personally I also put a link to the question/answer before the copied code) – Vi. Dec 25 '10 at 21:24
  • 4
    If you learn from it, then create something identical, then it may well be a "derivative" work, and the license clearly requires attribution and a similar open license. Creative Commons have an FAQ recommending not to use their licenses for source code, because of issues like this. GPL's FAQ suggests small snippets of code should be public domain (or similar), and GPL is not a suitable license. CC BY-SA is similar enough to GPL I think the same would apply? IANAL but I think whether or not something is copyrightable depends on it's complexity, and many SO answers are quite complex. – Abhi Beckert Dec 11 '11 at 20:14

The Creative Commons people have a note about this

It probably depends on the meaning of derived. It would be hard to make a case that incorporating a few lines of code would make the entire program a derivative work, and it would be hard to imagine somebody on SO mounting the expensive legal challenge which will almost certainly fail.

Perhaps it should be made the policy that code snippets fall under the CC BSD license as mentioned below, so that it's totally clear that incorporating code snippets in proprietary code is fine.

I personally use the "remember me if these 3 lines of code make you rich" license.

From the CC FAQ:

Can I use a Creative Commons license for software?

We do not recommend it. Creative Commons licenses should not be used for software. We strongly encourage you to use one of the very good software licenses which are already available. We recommend considering licenses made available by the Free Software Foundation or listed at the Open Source Initiative. Unlike our licenses, which do not make mention of source or object code, these existing licenses were designed specifically for use with software.

Creative Commons has “wrapped” some free software/open source licenses with a human-readable "Commons Deed" and machine-readable metadata. You may use these "wrapped" software licenses to take advantage of the Creative Commons human-readable document as well as the machine-readable metadata while still licensing your work under an established software license. It is important to note that CC has not altered these software licenses in any way, but has simply bundled human- and machine-readable explanations of the licenses along with the original license text.




If you're using code verbatim from any source, you should attribute it. That's just common courtesy.

That said, how much code on SO would you ever just copy into your program?

  • 14
    You're forgetting about the 'Remix' clause, or 'modifying or adapting' the code. Besides that, you MUST also redistribute the modified works under the same license. Besides the fact that this might be unenforcable in court and besides the common courtesy, a lot of corporations will dislike the legal 'littering' of the code. I agree with what you're saying about common courtesy, but I think this should be by choice, not as per a license agreement. – Evert Jul 8 '09 at 18:36
  • 1
    I didn't forget. AFAIK, the code is owned by its author, who may or may not be willing to grant you other terms should you request them. Again - how much code on SO are you using verbatim (vs. learning from it and writing your own). SO isn't a project-hosting site after all... – Shog9 Jul 8 '09 at 18:51
  • 1
    You're probably right.. It would be even nicer to also have the legal statement to back it up though. – Evert Jul 8 '09 at 18:57
  • This answer is dangerous. If you are using code verbatim you are in one of two situations; Either (1) the snippet is not copyrightable, you have no legal requirements, or (2) the snippet is copyrightable, you are required to give attribution and to licence your program that uses the snippet under a licence compatible with CC-by-sa. By giving attribution you are implicitly acknowledging that you are in case 2. – Taemyr Mar 3 '16 at 16:39
  • Being sneaky doesn't absolve you of responsibility, @Taemyr. As I said, common courtesy - if you owe more than that, this is true regardless of whether you're a jackass about attribution. Also, there are no non-CC licenses compatible with the version of CC-BY-SA used here, which - I hasten to emphasize - is not a code license. What requirements, if any, using CC-BY-SA code would place on a larger program is unknown; this has never been tested in court. In the unlikely event it ever did come to that, being a jerk about the attribution requirement is unlikely to work in your favor. – Shog9 Mar 3 '16 at 17:22
  • @shog9 I agree that there are con-CC licecences that are compatible, and as long as you are using a compatible licence there are no problem. If you are not using a complatible licence the way to prevent having to defend your use in court is to not use code from stackexchange. – Taemyr Mar 3 '16 at 18:55
  • No... @Taemyr... There are no compatible licenses. – Shog9 Mar 3 '16 at 18:57
  • @Shog9 OK. Sorry I misread your comment. My point is that if you are not in a compatible licence(ie. any licence other than CY-BY-SA), the only safe defence is to not use code from stackexchange. – Taemyr Mar 3 '16 at 19:57

As Shog9 mentioned, the amount of code you get from SO would not be enough to worry about licensing. Attribution, however, is always a good idea.

Stack Overflow does not own contributions. They are owned by the contributor. The CC licence helps to overcome having to ask each individual author, by applying a licence that allows use under certain conditions by default.

It's just like Wikipedia, now that they've changed to CC BY-SA. You can use content from there, as long as you stay within the license. Also, you have to use a substantial amount to have the Share-Alike kick in. For the small amount of code on SO, it's probably ok, but check with CC or a lawyer if you aren't sure.


As an author of software you have the right to license your software under which ever license you wish.

There is nothing stopping you releasing your code snippets under creative commons AND BSD or whatever.

In fact, all my original code snippet on SO are donated to the public domain (don't attribute me, I don't care), same goes for Marc.

Just because you post code to stack overflow, does not mean you are giving up ownership. So don't worry, you can share stuff that you have licensed under BSD on SO.

If stuff gets too long or hairy, post the samples to gist or github (or your favorite code snippet site) Jeff has said before that his intention is for SO to be like twitter for code.

Some stuff posted on SO is not even copyrightable, since its common knowledge.

However, if someone (which is not me since my stuff is PD) posts an implementation for an LFU cache and you copy it verbatim in to your app, your app has now been infected with the creative commons cancer, and you MUST release it under the cc-sharealike license.

  • 3
    +1 - You own all your posts, just because you've agreed to licence them under one licence doesn't mean you can't also licence the same code (or code including it) under a different licence. Firefox and Perl are just some examples of software which is available under more than one licence – theotherreceive Aug 16 '09 at 23:32
  • Yours last paragraph means CC-SA works like GPL? – jiggunjer Feb 5 '16 at 2:55

SO licenses its content under the CC license to be helpful, not as a hindrance.

I would then assume that content taken from this site is safe to use in proprietary software.

SO is most highly trafficked during business hours. People are using this code in their work as that is the intended use of the site. (Help programmers)

My non-law-background-opinion: Don't worry about it.

*Small caveat: Don't copy code from the internet.

  • 1
    obligatory complaint about a downvote w/out a comment :P – jjnguy Jul 8 '09 at 19:24
  • Can I downvote your comment for excessive italics? ... then not tell you why? – devinb Jul 28 '09 at 12:36
  • Actually, no. That feature has been declined over and over :P – jjnguy Jul 28 '09 at 13:07
  • 1
    I upvoted your comment instead. I figure that's punishment enough. – devinb Jul 28 '09 at 14:58
  • SO chose the CC-by-sa, they had the option to licence under CC-by. This alone implies that the share alike condition was intentended and might become legally enforcable. – Taemyr Mar 3 '16 at 16:41

This worries me for developing proprietary software, because now the app is not fully owned by my company anymore (and pieces are just licensed off SO). Our legal guys are probably not going to be happy with that.

If that's a serious concern, well then, don't use Stackoverflow to help you write your code. And don't google and take code off blogs either, because most of that is CC-licensed as well. And don't copy code out of reference books, because I doubt that's even CC-licensed.

  • That's a very good point.. – Evert Jul 8 '09 at 18:58
  • 6
    (-1) Your answer isn't helpful. He is saying "What are the implications" and your answer is "If you don't know, then I'm not going to tell you" – devinb Jul 28 '09 at 12:34

If it's the case that SO owned everything, I don't think I'd worry. I'm fairly confident that nobody really uses the exact code they find on SO. Often times you replace variables with your own, example strings, file-paths, and method names.

I've benefited greatly from the assistance here on SO, but I've never once used the exact response I was given.

If we own our code, I call shot-gun on concatenation!

$foo = $bar . $bar; // Property of Jonathan Sampson
  • 7
    Slightly changing the snippets falls under the 'Remix' clause of the CC license. By doing this and not attributing the author violates the license as far as I can tell. – Evert Jul 8 '09 at 18:32
  • 1
    My point is I don't think anybody owns the concatenation syntax :) – Sampson Jul 8 '09 at 18:35
  • can I call the keyword void or return? – jjnguy Jul 8 '09 at 18:36
  • @jinguy Sure. But I get private and protected – Sampson Jul 8 '09 at 18:38
  • Oooh! I get int! – DeadHead Jul 8 '09 at 18:39
  • 6
    Hmmm, I'll bet Jon Skeet owns half of all the code in the world by now.... – jjnguy Jul 8 '09 at 18:42
  • 1
    Make sure to attribute your use of -actual integers- to yours truly, please. – Andy Mikula Jul 8 '09 at 18:42
  • 3
    I'm sorry, this is an actual concern, and I'm just curious what people think about this. And I don't want to kill your joke, but the syntax you're describing would fall under 'prior art' and is made public domain on a under a ISO standards. If you feel this doesn't affect you at all, that's cool, I would appreciate taken serious though. – Evert Jul 8 '09 at 18:47
  • Oh, I also do believe copyright / patents on software is an outdated concept. I hope SO would set an example :) – Evert Jul 8 '09 at 18:49
  • Andy, which integers do you own? Can I have some...or have we run out? – Sampson Jul 8 '09 at 18:53
  • 2
    @Evert, the joke is a side-issue. You are taken seriously. – Sampson Jul 8 '09 at 18:54
  • 2
    I hereby lay claim to all string literals. – Bill the Lizard Jul 8 '09 at 19:19
  • Jonathan - I'm afraid I've used each from 0-9, inclusive. If you're interested, I have some very attractive licensing options. – Andy Mikula Jul 8 '09 at 19:54

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