Understanding Which License to Choose for Your Code

The Berne Convention dictates that any code you write is automatically copyrighted. However, many programmers prefer to release their code to the public through open-source licenses, which allows their work to be modified and improved upon, even as they retain core rights to the original code.

Distributing any work – a piece of code, a software program, or even markup – under an open source license implies that the original creator has granted specific permissions to re-use and re-distribute the work without prior approval. It does not equate to a relinquishing of all copyrights; instead, it facilitates the use of existing work by other programmers and developers, provided they credit the original author.

Not all open-source licenses offer the same provisions and copyright protection, however. Each open-source license must be approved by the Open Source Initiative (OSI). While the OSI approved-license count stands at 67, only a few of these are widely used by programmers.

Below, we’ll cover ten most-used open source licenses:

1. General Public License (GPL)

Approved in February 1989, the GPL is the most commonly used license for open source work with over 50,000 SoureForge.net projects in existence. Version 3.0 of the GPL includes provisions for others to copy and modify your code, but only if they include attribution to the original in the source code. The GPL also includes strong ‘copyleft’ measures.

‘Strong’ copyleft measures imply that any program that uses your code must be distributed under the same license. ‘Weak’ copyleft measures do not necessitate this restriction. Essentially, this dictates that if you borrow GPL licensed code, you have to release the finished software under GPL license too, and not any paid or proprietary license.
GPL v. 3.0 also provides direct patent protection – a provision lacking in most open-source licenses.

GPL includes provisions to allow you to sell the open-source software, but only if you explicitly mention that the software is open-source and can be downloaded for free.

2. GNU Library or Lesser General Public License (LGPL)

The LGPL includes fewer measures of protection than the GPL with only indirect patent protection and weak copyleft measures. This has made the LGPL the license of choice for libraries, as code licensed under the LGPL can be used in paid and proprietary software.

Only changes to the library code itself must be open-sourced; the remainder of a project using LGPL code may remain closed-source. The LGPL license was approved in June 1991 and covers over 8,000 SourceForge projects.

3. BSD License

The BSD license comes in multiple flavors, of which, the two most popular ones are BSD-3-Clause (or “New BSD license”), and BSD-2-Clause (“FreeBSD license). These two licenses offer less protection than the GPL, and simultaneously, fewer restrictions on distribution.

Both BSD licenses provide unlimited redistribution without any patent protection or copyleft measures. The BSD-3-Clause license differs from BSD-2-Clause in that it includes an anti-endorsement provision. Basically, this means that if you’ve contributed to any work, your name cannot be used to endorse or advertise the work without express permission.

4. MIT License

The MIT License is the oldest open-source license still in use and dates all the way back to September of 1987. It is also the broadest of all licenses with very sparsely defined provisions regulating distribution, endorsement and copyleft measures. Essentially, it provides for anyone to modify, copy and use any piece of the code or software howsoever he wants, as long as the finished product includes a copy of the license.

An update to the license – the MIT/X11 license – adds an anti-endorsement provision. This is the least restrictive open-source license and has over 1300 SourceForge.net projects in existence.

5. Mozilla Public License 2 (MPL 2.0)

Initially approved in 1998, the first version of the MPL (MPL 1.0) was more “business friendly” and included fewer copyright measures than the GPL. A January 2012 revision to the license – MPL 2.0 – corrected compatibility issues with the GPL and Apache licenses.

Broadly, the MPL 2.0 is compatible with both the GPL and Apache licenses (a provision lacking in MPL 1.0) and may be combined with proprietary code in a “larger body of work”. It also includes direct patent protection, and must include attribution in the source code.

6. Apache License v 2.0

The first version of the Apache license was drafted and approved in 1995. The Apache license is broad in its scope and grants significant rights to copyright holders. Specifically, it dictates that all rights are perpetual, global, non-exclusive, and irrevocable. Once granted rights, you are free to use them forever, anywhere in the world, and no one can take them away from you.

The non-exclusivity clause means that anyone can use the licensed work.
Besides, the v 2.0 of the Apache license also includes patent protection. It doesn’t include any copyleft measures, which means it is compatible with paid and proprietary software.

Image Source

7. Eclipse Public License (EPL)

The EPL was published by the Eclipse Foundation in 2004 and borrows most of its clauses from the GPL. The EPL superseded the Common Public License (CPL), originally published by IBM in 2001.

The EPL’s primary aim is to facilitate collaborative open-source development by allowing it to work with proprietary licenses. Consequently, it includes weak copyleft measures and is thus incompatible with the GPL. Under the EPL, anyone can edit, modify, copy and distribute any work, provided it does not borrow any work licensed under GPL.

8. Common Development and Distribution License (CDDL)

The CDDL is based on the MPL v 1.1. The CDDL is compatible with most open-source and proprietary licenses, save the GPL. It includes limited copyleft measures, and measures that allow anyone to edit, modify and use code with appropriate attribution in any work, commercial, or otherwise.

9. Open Software License (OSL)

The OSL is similar to LGPL in its clauses and weak copyleft measures, but differs from it in one crucial aspect: the OSL includes a ‘patent action termination clause’. Essentially, this means that the license is terminated automatically as soon as anyone files a patent infringement lawsuit. It also includes a clause that dictates that all derivative works must be distributed under the OSL license.

10. Academic Free License (AFL)

The AFL was published in 2002 in an attempt to remedy the deficiencies of the BSD, MIT and Apache licenses. It provides similar measures for redistribution, modification, and attribution, but adds a few more clauses that include patent and copyright grants for the software. The AFL is incompatible with the GPL on account of its lack of copyleft measures.

(20 Posts)

This article has been written by Keith Bryant. He is part of the DWUser.com team that offers software tools for developers and designers, including an easy and free jQuery slider builder and the EasyRotator Plugin for WordPress.


  • And what about CC Licenses? I think they are also a right licences for code too, not only for publishing.

  • CDDL is a great licensing distibution for online writers and casual bloggers. It helps them deter people from taking their work without permission.

  • Siggi-gross

    on new and unversioned projects i use this one: 
    F.O. – LICENSEPREAMBLE:the software you received alongside with this licenseis a proof of concept and not released yet.as it is under active development, it changes rapidly and comes with no warranty at all.your are free, for testing purposes, to do what ever you like with the code provided.in any case, be nice: projects of this young age getscared very easily, and its a bad world outside there ;-)RULES AND CONDTIONS:anyway, the software comes with a small set of F.O.-rules, you should consider.1. – if you like what you see – F.O. – Fine & OK    we highly appreciate any comments and suggestions on the project.  as this is a no-fund-project, please do not urge me to implement  anything as long you are not willing or able to pay me.  changes on the project are made on a daily basis and will  be done without any notice.  2. – if you think somthing is wrong – F.O. – Fork Off  you may give it a try on your own, if you like to do so.  in this case please let all copyright notices unchanged  and add your own afterwards. please let this license file  unchanged and in place, add your own credentials at  the bottom of this license.  if you come up with somthing usefull, please let us know.  3. – if you don’t like what you see – F.O. – please go away !COPYRIGHTS:        2012, me, email               (what i have done – initial proof of concept …) – please add your own here –

  • Most Probably people will like to use GPL. Most of the times i have used GPL only.

  • What about projects like Kendo UI and ExtJS which have dual-licensing? Are the licensing for those type of projects still based from the license discussed here or do they create their own license?

  •  Thanks very much… now I understand

  • I often choose General Public License (GPL) for my wordpress themes. :)

  • BSD licence. https://www.mirbsd.org/MirOS-Licence.htm specifically, otherwise often MIT.