All posts

Choose a License for Your GitHub Code

Pick the right open-source license: permissive, copyleft, or public domain.

Why a License Matters

Every repository needs a license. The license tells other people what they can do with your code.

This article explains the main licenses. It takes about three minutes to read.

Your code has automatic copyright. The author owns all rights.

Without a license, other people cannot legally use, copy, or change your code. If you want people to use your code, you must add a license.

Two Main Groups

Permissive licenses give users many rights. Users must keep the copyright notices.

Copyleft licenses also give users rights. However, users must share their changes under the same license.

Permissive Licenses

MIT is the most common license on GitHub. It is short.

Users can use, copy, change, and sell the software. They must include the copyright notice.

Apache 2.0 is similar to MIT. It also includes a patent grant.

Contributors give users permission to use their patents. Use Apache 2.0 when patents are a concern.

BSD and ISC are also short permissive licenses. They work in a similar way to MIT.

Copyleft Licenses

GPL-3.0 is a strong copyleft license. If you distribute a modified program, you must release the complete source code under GPL-3.0.

LGPL-3.0 is for libraries. Other projects can link to your library.

This includes closed-source projects. If you change the library itself, you must share those changes.

AGPL-3.0 adds one rule. If users run a modified version on a network server, they must offer the source code.

They offer it to the people who use it.

MPL-2.0 applies to single files. If you change an MPL file, you must share that file under MPL-2.0.

Other files in the project can use different terms.

Public Domain Licenses

CC0-1.0 and The Unlicense give up all copyright. Users do not need to include any notice.

Use these licenses when you want no restrictions.

How to Choose

Answer these four questions.

  1. Do you want no restrictions? Choose CC0-1.0 or The Unlicense.
  2. Do you want users to keep only the notices? Choose MIT.
  3. Do you want derived work to stay open source? Choose GPL-3.0.
  4. Do you want to protect a network service? Choose AGPL-3.0.

Next Step

When you create a repository on GitHub, you can pick a license. GitHub shows a license picker.

You can also visit choosealicense.com. The site explains each license in plain language.

This article gives general information. It is not legal advice.

For business decisions, consult a qualified lawyer.