Questions have been asked about this, and possible solutions discussed, but I can't find an actual feature proposal.

Software licensing is a big deal, and when I post to stack overflow, I as the author should be able to choose the license for my code snippets.

The license choices could be limited so that community wiki, etc. will still work. The main issue is share-alike. When I write a code snippet, I want it to be usable by professional, commercial programmers as well as those who work on open source share-alike projects. I don't want to limit professionals interested in my solution and keep them from using my code snippets.

I propose that we place a checkbox in the "answer" form, allowing authors to choose between CC BY-SA and CC BY. The fine print at the bottom of the page can say that everything on Stack Exchange is licensed CC Wiki unless otherwise noted.


I've seen the other side to this debate that I started and thought I'd share my thoughts.

Suppose, as @TRiG has suggested, I release an answer under two licenses: CC wiki and CC0. Then someone edits my answer. By many countries' laws, by someone editing my answer, they create a derivative work (meaning that they are legally allowed to modify my work and then they do modify it), so that it becomes their copyright. They now have the right to choose which license they use the derivative work: CC wiki or the other license, CC0. They can then remove the CC0 license anyway, or even close the answer to further editing by copyrighting it.

So then suppose that we don't like this, but we still want people to do what they want with our answers. So we license the entire site under CC0. Then anyone could take our answers and edit them, copyright the edited version, and sue others who try to edit it later.

This is why the site needs to have a share-alike license. If we are to expect to be able to edit answers at all, to share knowledge and improve on it at all, we need a license that will enforce that.

The problem still remains that when many people answer a hard coding question on Stack, they often answer it with a non-trivial set of lines of code, which many often simply copy and paste into their own code. The license is clear:

Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.

  1. If I want to release the code I wrote, I must indicate both the author and which changes were made? How do I even keep track of that on an SO answer? Now, SO has given guidance on this point, but this policy still suffers from the same problems as the old BSD license, in that you have to provide a hyperlink (legally) to every user who ever touched the answer. I don't even know that SO keeps track of this information.

ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.

  1. So, if I want to use this piece of intellectual property in my own proprietary code, I have only a few options available:
  2. Completely rewrite the code. If I do, how do I show that it came from my head and is not plagiarization?
  3. Use the code for educational purposes. At least in the US as long as it's for school assignments (pretty much) anything is fair game.
  4. Somehow pass my using SO code off as "fair use", which is ridiculous because I'm not commenting on or criticizing the code; I actually want to use it.

Therefore in many ways my dilemma still stands. I realize that maybe a checkbox isn't the answer, but I feel that there is still a very important issue here that needs to be addressed.

  • Why would a professional/commercial programmer per prohibited from using a CC-wiki license. It was specifically chosen because, unlike the GNU licence, it doesn't require applying the same license to derived works.
    – Servy
    Commented Mar 12, 2014 at 19:29
  • 8
    "ShareAlike — If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original. " -- creativecommons.org/licenses/by-sa/2.5 Commented Mar 12, 2014 at 19:31
  • @Servy Atwood's posts in the past indicated that the license was chosen for its applicability to the written content of posts, not for its suitability for code (which does not seem as good).
    – Jeremy
    Commented Mar 12, 2014 at 19:32
  • 9
  • 5
    Programmers do have a choice: Accept the license Stack Overflow applies to all posts, or not post. Why complicate matters more? You can always add additional license terms to your own works anyway; if you want to be more permissive, dual license it by stating so in the post. Commented Mar 12, 2014 at 19:33
  • 3
    In fact, if you go to the CC website it specifically says that programmers are not encouraged to use CC licenses for code. It recommends the use of "software" licenses instead: creativecommons.org/software Commented Mar 12, 2014 at 19:35
  • @MartijnPieters, because I wan't to contribute, but I don't want to limit others from using my stuff. Commented Mar 12, 2014 at 19:35
  • 1
    In the global Stack Exchange context, this is completely moot. That means we would have to special-case this into SO and maybe a few others (Code Review, maybe Programmers, etc.). Not sure it's worth the effort, to be honest. Commented Mar 12, 2014 at 19:36
  • @FrédéricHamidi, why don't we put it into all the stack exchanges? CC is a wiki license primarily anyway. Commented Mar 12, 2014 at 19:38
  • @djhaskin987, I don't think users of all the other sites care about specific licensing at all (after all, as you say, it only causes an issue with code). Why bother them with a new checkbox? Commented Mar 12, 2014 at 19:41
  • @FrédéricHamidi, so that they have a choice. Commented Mar 12, 2014 at 19:41
  • @FrédéricHamidi The case isn't that "special" when it applies to the vast majority of the content on the network.
    – Jeremy
    Commented Mar 12, 2014 at 20:26
  • 6
    @MartijnPieters Users frequently copy code from Stack Exchange posts, whether that fits some imagined ideal or not, and almost every time they do so they are either violating copyright law or relying on a possibly-invalid fair use claim. It would be good if Stack Exchange could acknowledge this reality and directly support licensing appropriate to this use.
    – Jeremy
    Commented Mar 12, 2014 at 20:29
  • 1
    @Jeremy, I was thinking more from a UI standpoint, and I still believe that applying this to the whole network is not necessary and may be counter-productive (check boxes you don't understand are scary). However, I agree choice in licensing can be useful with code, which is, you're right, the majority of the SE content right now (and probably for 6 to 8 more weeks, I concede). Commented Mar 12, 2014 at 20:36
  • 2
    Here a "Public domain" checkbox is suggested: What is up with the source code license on Stack Overflow?
    – unor
    Commented Mar 13, 2014 at 16:45

2 Answers 2


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, CC BY, or WTFPL (or all three, or any two, or whatever).

Another option is the Wikipedia template 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.

Seems reasonable. There’s nothing stopping you putting some code here with a comment at the top:

// License: CC BY (http://creativecommons.org/licenses/by/4.0/)

That’d be sufficient.

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

  • 2
    This is good info, but there should be a feature in the UI nevertheless: the vast majority of users posting on SO is never going to even be aware of the issue otherwise.
    – Pekka
    Commented Apr 4, 2014 at 15:29
  • Definitely a good temporary workaround. Commented Apr 5, 2014 at 23:59
  • 1
    However, this gets difficult is someone edits your post. The comment remains but is no longer true unless the editor also puts such a comment in Commented Apr 15, 2014 at 14:56
  • You can still use the original revision if the editor hasn't changed the code. Commented Apr 15, 2014 at 15:00
  • Accepting the answer because it seems the best solution so far. Commented Dec 17, 2015 at 15:30

SO (and SE) aren't about posting the exact code to accomplish something, anyway. You should be explaining how to do something, using a block of code as an example or part of the explanation - but you shouldn't be getting a complete program from it anyway.

A good metaphor for this is the world of art. Pablo Picasso's estate owns the copyright to the paintings he painted during his life, and so you are not permitted to take pictures of them, make prints of them, or to otherwise electronically or mechanically duplicate them without his permission.

However, if you want to look at a Picasso work as inspiration, and draw a similar work by hand, you're welcome to. That's how art works, after all; people draw on other works for inspiration or for a technique all the time.

SO should work the same way. You ask a question, see the example for the technique to get around your problem, then implement the technique. If it's such a simple thing that there's no way to implement it without duplicating the text exactly, so be it - then it's probably not something really covered by copyright in any event. Something more complex hopefully would require reworking to fit your product in any event.

I don't think that adding another checkbox to the UI is necessary for the (hopefully rare) cases where this would actually matter, and I don't think that the folks who are using SO to do significant bits of programming for them are a community I particularly want to take action to support in any event.

You must log in to answer this question.

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