I was wondering what kind of restrictions there are, if any, for code posted on StackOverflow?

In other words, I'm hoping StackOverflow has a clause that makes any posted code completely free of restrictions for reuse? (Both questions and answers).


2 Answers 2


Right down at the bottom of every page is "user contributions licensed under cc-wiki with attribution required".

"User contributions" links to questions-all, but I don't think "user contributions" is solely limited to questions. All code posted here is thus licensed under cc-wiki with attribution required.

Edit: If you click on any of the related links down the right side that seem relevant, you'll find that the copyright owner becomes Stack Overflow (or, I guess to be correct, Stack Exchange Inc.), and that's who you'd have to attribute. See also this question.

Edit 2: There's also this answer from Jeff Atwood, which may or may not clear things up for you.

  • 1
    What level of attribution? Is a hyperlink enough?
    – Casebash
    Jul 6, 2011 at 2:38

No matter what the legal implications are, you should never use code samples found online.

You should always read the code, understand what it is doing, then close the browser tab and use that understanding to code.

  • 6
    +1 for the idealism ;-)
    – Matt Handy
    May 9, 2011 at 17:19
  • @MattHandy: Please, I don't give a...
    – user1228
    May 9, 2011 at 17:25
  • Sorry about my English. What is the meaning of understand ? May 10, 2011 at 3:05
  • @Wether: to know how and why it works, and to be able to reproduce the same effects without referencing the original code.
    – user1228
    May 10, 2011 at 13:10
  • @Will Ohhh... And you want that from a programmer :) May 10, 2011 at 13:14
  • @Wether: Sarcasm. I get... I mean, I understand now.
    – user1228
    May 10, 2011 at 13:36
  • But what if you happen to end up retaining bits of the code itself in your memory? It seems to me the only "safe" way is "just never use any answers that involve substantial amounts of non-trivial code for the given solution". Apr 20, 2022 at 14:36

You must log in to answer this question.

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