Code needs a license


Disclaimer: IANAL (I Am Not A Lawyer)

First off, I have to say that the majority of this is paraphrased/ripped off from a short talk that Jacob Kaplan-Moss ( @jacobian) gave to a local user group I had attended. Basically all of the credit goes to him, but I thought it was important enough to make sure it found its way onto the internet in some form or another.

License your code!

The default license for anything published in the United States (and from the US) is All Rights Reserved. That basically means that if someone copies and pastes code that someone uses as example code on their blog, later, if they feel like it, they can sue you. That is obviously very bad, and likely not what the original poster intended. However, the fix for this is simple. Just include a license statement, either with the code itself or a generic one (like the one at the bottom of this page) that gives a default license for code on your site. Even if your code is on GitHub, Pastebin, etc... the default license is STILL All Rights Reserved, which means you can't use it w/o fear of legal repercussions.


Just a quick rundown on some of the terms you're likely to find when looking up licenses:

The legal right to make a copy and to assign that right to others Copyleft
Copyright plus free distribution, requires all copies to be copyleft. Copyleft is not "giving away code for free", there is basically no way to legally give away intellectual property. It's just a legal hack. License
Formal permission to do something

Copyleft is not anti-copyright. Copyleft only works because of the legal teeth that copyright has in the first place.

License Choices

Go to, they have a ton of them. HOWEVER, you can most likely limit your choices significantly based on a few key questions. DO NOT make your own, that only adds confusion and legal uncertainty. If you're unsure about which license to use, pick one of the first two: - BSD/ MIT (X11) - weak copyleft. simple - (L)GPL v3 - strong copyleft, bells and whistles - Apache license - weak copyleft, bells and whistles - Mozilla Public License (MPL) - medium copyleft, bells and whistles

A license (and the law surrounding it) doesn't truly get set in stone until there is a legal challenge to it in court and a precedent is set.

Choosing a license (semi-flowchart):

  1. Do you have/can you afford a lawyer? Listen to them
  2. Is there a standard license in the community with which you're working? Follow it
  3. Do you want strong copyleft? If so, BSD
  4. Are you writing a library? If so, LGPL, if not, GPL


If you release code, include a LICENSE file. If you intend to use other peoples' code, have a LICENSE file. If you're publishing code on your blog, say what license you're publishing it under, or include a generic license statement in your footer


Tags: license