License for blogged code snippets

Something I’ve never really thought about when I’ve shared some code in a blog post is all the copyright / legal mumbo jumbo. After some reading on the subject, I’m still pretty confused (no surprises there), but from what I think I understand it goes something like this:

  • By default, anything code you post (unless otherwise stated) is copyrighted to you.
  • In theory, you could assert your copyright, at any time, against anyone using the code.

Sounds a little ridiculous to me, since you’ve shared it with the world. But some places and their legal departments would prefer to play it safe.

I’m thinking of using the Creative Commons Zero license “CC0” for code snippets on my blog. Which attempts to put the associated code in the public domain or closest equivalent for different jurisdictions. Why?

  • I don’t really care what the code is used for.
  • It states that if you use the code, you can’t blame me for anything.
  • Doesn’t require you to include a “LICENSE” statement or file in any derivatives or distributions and the like.

From this point forth I’ll be making sure I specify CC0 or whatever license is applicable for snippets of code I post. Plus I’ll try and work my way through older posts to do the same. I’d love to hear peoples thoughts on this, licenses they might use or why they don’t think it’s important. Also, I found a post by Jeff Atwood (Coding Horror) to be really useful on this topic, "Pick a License, Any License".


David Boyer
David Boyer

Full-stack web developer from Cardiff, Wales. With a love for JavaScript, especially from within Node.js.