I sometime post code to StackExchange sites like StackOverflow or CodeReview. To meet the requirements of the site you often have to post full code to get help. This is often code I would like to later publish to certain sites for sale.

When I do this I am always quite worried that my code is now visible to millions of people that could simply copy/paste my code into a notepad file and have the same product as me, completely devaluing mine.

As far as I know once your idea/product is made public in a timestampable way it is considered intellectual property. But how does that hold up when you freely post it to a knowledge sharing site like this that you cannot include licenses on. Even if it were determined that it were your own intellectual property would it be a worthy cause to fight for when the code might make you a few hundred dollars if anything?

  • 1
    At least for SO, I guess this will provide you extra incentive to strip your code down to an MCVE, rather than posting the original code in its entirety (which is not encouraged). Aug 12, 2016 at 3:18
  • @NateEldredgeThat is what I try to do for the most part, but then sometime I get encouraged in comments and such to post the actual code so they can really help.
    – DasBeasto
    Aug 12, 2016 at 3:33
  • unless you are pasting a huge part/important of the code, there is no way they could use your code to make money
    – mou
    Aug 12, 2016 at 8:43
  • You should not post actual code you're having a problem with. Instead, you should post an SSCCE (Short, self contained, compilable example) that demonstrates your problem.
    – Brandin
    Aug 25, 2016 at 5:08

1 Answer 1


From the SE ToS, which is probably relevant:

3. Subscriber Content

You agree that all Subscriber Content that You contribute to the Network is perpetually and irrevocably licensed to Stack Exchange under the Creative Commons Attribution Share Alike license. You grant Stack Exchange the perpetual and irrevocable right and license to use, copy, cache, publish, display, distribute, modify, create derivative works and store such Subscriber Content and, except as otherwise set forth herein, to allow others to do so in any medium now known or hereinafter developed (“Content License”) in order to provide the Services, even if such Subscriber Content has been contributed and subsequently removed by You. Subscriber warrants, represents and agrees Subscriber has the right to grant Stack Exchange and the Network the rights set forth above. Subscriber represents, warrants and agrees that it will not contribute any Subscriber Content that (a) infringes, violates or otherwise interferes with any copyright or trademark of another party, (b) reveals any trade secret, unless Subscriber owns the trade secret or has the owner’s permission to post it, (c) infringes any intellectual property right of another or the privacy or publicity rights of another, (d) is libelous, defamatory, abusive, threatening, harassing, hateful, offensive or otherwise violates any law or right of any third party, (e) contains a virus, trojan horse, worm, time bomb or other computer programming routine or engine that is intended to damage, detrimentally interfere with, surreptitiously intercept or expropriate any system, data or information, or (f) remains posted after Subscriber has been notified that such Subscriber Content violates any of sections (a) to (e) of this sentence. Stack Exchange reserves the right to remove any Subscriber Content from the Network, re-post to the Network any Subscriber Content removed by any Subscriber or former Subscriber, suspend or terminate Subscriber’s right to use the Services at any time, or pursue any other remedy or relief available to Stack Exchange and/or the Network under equity or law, for any reason (including, but not limited to, upon receipt of claims or allegations from third parties or authorities relating to such Subscriber Content or if Stack Exchange is concerned that Subscriber may have breached the immediately preceding sentence), or for no reason at all.

In the event that You post or otherwise use Subscriber Content outside of the Network or Services, with the exception of content entirely created by You, You agree that You will follow the attribution rules of the Creative Commons Attribution Share Alike license as follows:

You will ensure that any such use of Subscriber Content visually displays or otherwise indicates the source of the Subscriber Content as coming from the Stack Exchange Network. This requirement is satisfied with a discreet text blurb, or some other unobtrusive but clear visual indication. You will ensure that any such Internet use of Subscriber Content includes a hyperlink directly to the original question on the source site on the Network (e.g., https://stackoverflow.com/questions/12345) You will ensure that any such use of Subscriber Content visually display or otherwise clearly indicate the author names for every question and answer so used. You will ensure that any such Internet use of Subscriber Content Hyperlink each author name directly back to his or her user profile page on the source site on the Network (e.g., https://stackoverflow.com/users/12345/username), directly to the Stack Exchange domain, in standard HTML (i.e. not through a Tinyurl or other such indirect hyperlink, form of obfuscation or redirection), without any “nofollow” command or any other such means of avoiding detection by search engines, and visible even with JavaScript disabled.

So yes, people can reuse your code, so long as they put it under the same license terms as SE granted it to them under.

  • Ok so it appears that whatever you post immediately falls under the Creative Commons Attribution Share Alike license? Thats's quite disappointing.
    – DasBeasto
    Aug 12, 2016 at 2:09
  • Note the second paragraph, though, but I don't know the terms of the license in question so it might be relevant.
    – Stackstuck
    Aug 12, 2016 at 2:12
  • 1
    @Stackstuck: creativecommons.org/licenses/by-sa/3.0/us/legalcode. The license provides that Stack Exchange may redistribute it, and anyone to whom they distribute it (i.e. any user of the site) gets to use and copy it under the terms of that same license. Aug 12, 2016 at 3:10
  • 1
    Oops, it was buried in the terms of the CC license all along. Each time You distribute or publicly digitally perform the Work (as defined in Section 1 above) or a Collective Work (as defined in Section 1 above), the Licensor offers to the recipient a license to the Work on the same terms and conditions as the license granted to You under this License.
    – Stackstuck
    Aug 12, 2016 at 3:44
  • 2
    @DasBeasto CC-BY-SA is license which isn't viable for most business models due to the share-alike clause. Also, I got 36k rep on SO, 37k rep on Gamedev and 16k rep on Programmers. In all the time I never saw a code snippet which was even remotely long enough to be a commercially viable product just on its own. Personally, I dual-license all my code contributions to stackexchange under CC-BY-SA and WTFPL.
    – Philipp
    Aug 12, 2016 at 14:45

You must log in to answer this question.

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