All articles
165 articles · updated weekly See our Tools
All articles
Tutorials

How to Choose a License for Your Open Source Project

A practical decision tree: no license means closed, permissive vs copyleft, dual licensing, and when MIT simply isn't enough.

How to Choose a License for Your Open Source Project
COVER · Tutorials

I've seen a public repository with 2,000 stars and no LICENSE file. The author thought he was "giving the code away". In practice nobody could legally use it — and the first company that wanted to adopt the library opened an issue asking for a license, because their legal team blocked it. On the other side, I've seen a team put MIT on a product they later needed to close, and find out there's no way to "un-give" what was already published.

Choosing a license doesn't start at "MIT or Apache?". It starts earlier: do you want third parties to use this code, and under which conditions? This post covers that decision for your project — including the options that aren't open source, like no license at all, BUSL and SSPL. If you already know you want an open license and just need to compare the classics, the post MIT, Apache and GPL: what each license actually allows does that clause by clause.

A repository with no license: what others can do

Almost nothing. With no license, default copyright applies: the code is yours with all rights reserved, and nobody can copy, modify or redistribute it without your permission. choosealicense.com, maintained by GitHub, says exactly that.

The detail that confuses people: by publishing a public repository you accept GitHub's Terms of Service, which let other users view and fork the repository on GitHub. That's it. choosealicense.com itself warns that this does not mean permission to use, modify or share the software for any purpose.

Public GitHub repo without LICENSE:
no:  Use it in another project (commercial or not)
no:  Copy and redistribute
no:  Modify and publish the modified version
yes: View the code
yes: Fork it on GitHub (Terms of Service)

So "no license" is a legitimate choice when you want to show the code (portfolio, transparency, study) without authorizing use. Just don't call it open source. Open source, under the OSI's Open Source Definition, requires a license that guarantees free redistribution, access to source, derived works and no discrimination against people or fields of use — ten criteria, not a public repository. The difference between open source, free software and source available is covered in what open source is.

The trap with "no license" is outside contributions. If someone opens a pull request and you merge it, their code enters the repository with no agreed terms. If you ever want to open the project, you'll need their permission too.

Want people to use it? Permissive or copyleft (the short version)

If the answer is "yes, I want people to use it", the next question is whether you care what they do afterward.

  • Permissive (MIT, BSD, Apache 2.0): anyone can use it, including in closed products, as long as they keep the copyright notice. Apache 2.0 adds an explicit patent grant.
  • Copyleft (GPL, LGPL, AGPL): whoever distributes a derived work must distribute it under the same license. AGPL extends that to software offered over a network, which is the SaaS case.

The details — GPLv2 and Apache 2.0 compatibility, when LGPL is enough, internal use of AGPL — are in the MIT, Apache and GPL comparison. Here the point is just the decision axis: permissive maximizes adoption, copyleft maximizes the guarantee that improvements come back open. AGPL examples today: Grafana, Loki and Tempo, which switched from Apache 2.0 to AGPLv3 in April 2021, plus Nextcloud and Mastodon.

If the project is personal and you have no concrete reason for copyleft, MIT is still the path of least friction.

Want the code public, but no competitor reselling it? Source available

This is the category that grew the most in recent years and that "MIT vs GPL" doesn't cover: source available licenses. The code is visible, you can study it and often modify it, but use is restricted. None of them is OSI-approved, so none is open source in the technical sense. The main ones:

License What it restricts Becomes open later?
BUSL 1.1 (Business Source License) Production use, except what the Additional Use Grant allows Yes: on the Change Date or the version's 4th anniversary, whichever comes first
SSPL (Server Side Public License) Offering the software as a service without releasing the source of the whole service stack No
Elastic License 2.0 Offering it as a managed service and circumventing license keys No
FSL (Functional Source License) Use that competes with the author's product Yes: Apache 2.0 or MIT after 2 years

BUSL is the most poorly explained of the bunch. The BUSL 1.1 text allows copying, modifying and non-production use — not "non-commercial use". The author can allow some production use through an Additional Use Grant (HashiCorp, for instance, allows production use as long as it isn't a competing product). On the Change Date — which can't be later than four years after the version is published — that version's code converts to the Change License, which must be GPLv2 or compatible with it. HashiCorp adopted BUSL 1.1 in August 2023, moving away from MPL 2.0.

The FSL, created by Sentry, follows the same logic with a shorter clock: each version becomes Apache 2.0 or MIT two years later.

How to read a "restricted license" before using it

If you're going to consume something source available, read three things: what counts as production or competing use, what the additional grant allows, and when each version converts. If you're going to publish, BUSL or FSL is the honest way to say "you can look and test, but you can't resell" — much clearer than publishing with no license and hoping.

Who changed licenses (and who came back)

Recent history shows a license isn't forever — and that changing it costs you community goodwill:

  • MongoDB: moved from AGPLv3 to SSPL for versions released on or after October 16, 2018.
  • Elasticsearch and Kibana: swapped Apache 2.0 for SSPL/Elastic License in 2021 and, on August 29, 2024, announced AGPL as an additional option.
  • HashiCorp (Terraform, Vault etc.): MPL 2.0 to BUSL 1.1 in August 2023. The community answered with the OpenTofu fork.
  • Redis: moved to RSALv2/SSPL in March 2024 and added AGPLv3 in Redis 8, in May 2025. In between, the Valkey fork was born at the Linux Foundation, backed by AWS and Google.

The pattern: a company switches to source available to protect itself from cloud providers, the community forks, the company comes back to an OSI-approved license — and AGPL became the preferred middle ground.

Want to sell a commercial license? Dual licensing needs a CLA

Dual licensing means publishing under GPL or AGPL and selling a commercial license to whoever doesn't want to comply with copyleft. MySQL and Qt are the classic cases.

The condition is controlling all the copyright. Contributors keep the copyright of what they wrote; without a CLA (Contributor License Agreement) giving you the right to relicense, you can't sell their contribution under another license. That's why the CLA has to be in CONTRIBUTING.md before the first external pull request, not after the fiftieth. The contributor's side — and why some devs refuse to sign CLAs — is in how to contribute to open source.

Changing the license later: possible, but expensive

If you're the only author, relicensing is trivial: publish the next version under the new license. Old versions remain available under the original license for whoever already has them.

With outside contributors and no CLA, you need permission from each one. The Linux kernel is the usual example, but the real story is different: the kernel never tried to move to GPLv3. Its COPYING file states "GPL version 2 only", and Linus Torvalds publicly rejected GPLv3 in 2006, while it was being drafted. The practical point is that without an "or later" clause and with thousands of copyright holders, such a move would be infeasible even if someone wanted it.

Before publishing, audit what you use

Your license can't be more permissive than your dependencies allow. A GPL library inside an app distributed under MIT is your problem, not the library author's. Running a license report in CI is cheap:

# npm: summary of installed dependency licenses
npx license-checker --summary --excludePrivatePackages

# Python: table of licenses for the environment's packages
pip install pip-licenses
pip-licenses --order=license --format=markdown

I ran both in November 2026: license-checker still works, but hasn't had a release since 2022 — use it knowing that. License is one of the criteria in the checklist on how to tell if a library is trustworthy, and the history above shows why it's worth rechecking on every major upgrade: Redis and Elasticsearch changed licenses between one version and the next.

Frequently asked questions

Can I use code from a repository with no license?

Not without the author's permission. With no license, the code is under copyright with all rights reserved; GitHub's Terms of Service only allow viewing and forking on the platform. If you need to use it, open an issue asking the author to add a license.

Are BUSL and SSPL open source?

No. Neither is OSI-approved, because both restrict fields of use — production for BUSL, offering as a service for SSPL. BUSL has the particularity of converting each version to a GPL-compatible license within four years; SSPL never converts.

Is MIT enough for most projects?

For a personal project, library or tool you want adopted, yes. Consider Apache 2.0 if patents matter, GPL or AGPL if you want derivatives to stay open, and BUSL or FSL if you want to stop a competitor from reselling it.

Can different parts of the project have different licenses?

Yes. Documentation under Creative Commons and code under MIT is common, as is an open core with closed commercial modules. Make it explicit which file has which license, with SPDX headers (SPDX-License-Identifier: MIT) and a LICENSES/ folder with the texts.

Decide the intent first, the license comes after

Four questions settle almost every case: do I want people to use it? Do I care if they close the derived code? Do I need to stop a competitor from reselling it? Will I sell a commercial license? The answers point, in that order, to no license, permissive, copyleft, source available, and dual licensing with a CLA.

Decide before the first external pull request, because after that the license becomes much harder to change. And use the canonical license text: a hand-edited LICENSE may stop being recognized by GitHub and by audit tools. When I inherit a repository, I paste the file and the official text into the Diff Checker to see whether someone tweaked a clause.

RD
Author
Rafael Duarte
Backend developer with a background in fintech and B2B SaaS — worked on teams that scaled APIs from zero to millions of requests. Carries enough production scars to hold strong opinions on tools, patterns and architecture decisions. Not an academic: he read the UUID RFC when he had to choose between v4 and v7 for a write-heavy table.
View profile