Skip to content
Open {re}Source

    Open {re}Source

    Choosing a License: Four Questions and a Table

    Module 05 of 10Chapter 01 of 06

    Part of a free guide to open source. Each module stands on its own.

    Published
    2024-02-06
    Updated
    2026-10-08
    Reading time
    5 min

    Pick MIT if you don’t mind what people do with your code, Apache-2.0 if you care about patents, GPL-3.0 if you want changes to come back, and AGPL-3.0 if those changes run on servers. That’s the whole chapter for most readers. The rest is for explaining the choice, applying it properly, and changing it later.

    Section 01 of 09

    No license means no permission#

    Copyright applies to code the moment it’s written. Publishing it on GitHub doesn’t change that: without a license, others can read your code, but not use, copy, modify or share it (choosealicense.com). A license is the permission.

    An open-source license grants that permission under conditions. The Open Source Definition, maintained by the Open Source Initiative (OSI), lists ten criteria a license must meet to count: free redistribution, access to the source, the right to make derived works, no discrimination against people or fields of use, and six more. The OSI approves licenses against it. Stick to an approved one: companies’ legal teams already know them, and a license you write yourself is one they’ll have to read.

    Section 02 of 09

    Four questions pick the license#

    1. Is it code? For documentation, images or other content, use a Creative Commons license: CC-BY-4.0 to require credit, CC0-1.0 to waive everything. Creative Commons itself recommends against its licenses for software. Licenses for Things That Aren’t Code covers the rest: fonts, hardware, data. For code, go on.
    2. Must modified versions stay open? If you don’t mind someone shipping a closed product built on your code, you want a permissive license: question 3. If you want their changes to come back as open source, a copyleft one: question 4.
    3. Do patents matter? Apache-2.0 grants a patent license from every contributor, and withdraws it from anyone who sues over patents in the project. Companies often prefer it for that. If patents don’t matter to you, MIT says the same in far fewer words.
    4. Where does the code run?
      • On servers that people use over a network: AGPL-3.0. Plain GPL only applies when a program is distributed, and a web service isn’t.
      • As a library inside other people’s programs: MPL-2.0 (changes to your files come back) or LGPL-3.0 (changes to your library come back). The program that uses it keeps its own license.
      • Anywhere else: GPL-3.0.

    Section 03 of 09

    Ten licenses, side by side#

    What each license asks of the people who use your code, from choosealicense.com’s summary of each text, with a project that uses each one (as of September 2026):

    License, used byThe user mustPatent grantCopyleft covers
    AGPL-3.0-or-later
    Mastodon
    Same as GPL, and offer the source to users over a networkYesThe whole work, network use included
    Apache-2.0
    Kubernetes
    Keep the notices, and state their changesYes, ends for a patent suitNothing
    BSD-2-Clause
    Homebrew
    Keep the copyright and license noticeNot explicitNothing
    BSD-3-Clause
    Go
    Same, and not use the authors' names to promote their productNot explicitNothing
    CC0-1.0
    GitHub's gitignore templates
    NothingExplicitly not grantedNothing
    GPL-3.0-or-later
    Ansible
    Keep the notices, state changes, share the source of the whole workYesThe whole work, when distributed
    LGPL-3.0-or-later
    go-ethereum's libraries
    Keep the notices, state changes, share the source of the libraryYesThe library
    MIT
    React
    Keep the copyright and license noticeNot explicitNothing
    MPL-2.0
    OpenTofu
    Keep the notices, and share the source of the files they changedYesThe modified files
    Unlicense
    yt-dlp
    NothingNot explicitNothing

    Every one of them also disclaims warranty and liability: the code comes as is.

    Section 04 of 09

    Copyleft follows the code, not the project#

    “Changes must come back” means something precise, and it depends on how the code is used.

    • In an app you distribute, GPL code makes the whole program GPL: if you ship it, you ship its source under the same license.
    • In a web service, GPL asks for nothing, because the program is never distributed: users only talk to it. AGPL-3.0 closes that gap, and asks you to offer the source of your modified version to the users who interact with it over a network.
    • In a library, LGPL-3.0 and MPL-2.0 draw the line around the library or its files. A closed application can use them; changes to the library itself come back.

    This is why AGPL-3.0 worries companies. Google’s open-source policy says code under it “MUST NOT be used at Google”, and many companies have similar rules. For some projects, that’s the point: Grafana moved to AGPL-3.0 in 2021 so that anyone who modifies it and runs it as a service shares their changes back.

    Section 05 of 09

    Apply it in three places#

    1. A LICENSE file at the root, with the full text, the year and the copyright holder. On GitHub, create a file named LICENSE, and a Choose a license template button fills it in (GitHub’s docs). GitHub then shows the license in the repository’s About box.

    2. The license field of your manifest, with the SPDX identifier, so that package managers and compliance tools read it without guessing:

    { "license": "MIT" }
    # pyproject.toml, since PEP 639
    license = "MIT"
    license-files = ["LICENSE"]
    # Cargo.toml: the Rust ecosystem's usual dual license
    license = "MIT OR Apache-2.0"

    3. An SPDX header in each file, optional but precise when a repository mixes licenses. The REUSE specification and its reuse lint tool check that every file has one:

    // SPDX-FileCopyrightText: 2026 Your Name
    // SPDX-License-Identifier: MIT

    For the GPL family, choose “only” or “or later”. GPL-3.0-only stays on version 3; GPL-3.0-or-later lets users apply a future version the Free Software Foundation publishes. The Linux kernel is GPL-2.0-only, one reason it never moved to GPL-3.0.

    Section 06 of 09

    You can only relicense what you own#

    Switching your own code to another license is easy: publish the next version under it. Code that others contributed is theirs, under the license they contributed it under. To relicense a project with outside contributions, you need the agreement of every contributor, or a contributor license agreement (CLA) they signed that grants you that right. The Developer Certificate of Origin (DCO), which the Linux kernel uses, only certifies that contributors have the right to submit their code: it doesn’t let you relicense it. CLA or DCO covers both, from each side.

    Old versions keep their license, whatever happens next. That’s how OpenTofu and Valkey could fork Terraform and Redis from their last open-source versions, after both companies moved to licenses that aren’t open source. Relicensing has the whole timeline, and the licenses they moved to.

    Section 07 of 09

    Tools#

    • Licenses quick reference: the same ten licenses with their SPDX identifiers, OSI status and links to the texts.
    • choosealicense.com, by GitHub: the licenses compared, and “no license” explained.
    • SPDX License List: every identifier, with the full texts.
    • licensee: the tool GitHub uses to detect a repository’s license. Run it to see what GitHub will see.
    • REUSE, by the Free Software Foundation Europe: SPDX headers in every file, and a linter for them.

    License Compatibility covers the other direction: the licenses of the code you include.

    Section 08 of 09

    Do this now#

    • Check that your project has a LICENSE file, and that GitHub shows its name in the About box.
    • Put the SPDX identifier in the license field of your manifest.
    • If you use a GPL-family license, decide between “only” and “or later”, and use the matching identifier.
    • Look up the license of your three biggest dependencies, and check that it allows what you do with them.

    Section 09 of 09

    Go further#

    Guide contents

    10 modules, 47 chapters. Each module stands on its own.

    1. 01What Is Open Source?6 chapters
      1. 00Overview
      2. 01Definition of Open Source
      3. 02Brief History of Open Source
      4. 03The Significance of Open Source
      5. 04Ten Successful Projects and What to Steal From Them
      6. 05The Many Shapes of Open Source
      7. 06Benefits of Open Source
    2. 02Getting Started5 chapters
      1. 00Overview
      2. 01Source Code Hosting Platforms: GitHub and the Alternatives
      3. 02Finding Open-Source Software to Use
      4. 03Reading a Repository in Five Minutes
      5. 04Open Source Etiquette: Talking to Strangers Who Owe You Nothing
      6. 05Git and GitHub Basics You Actually Need
    3. 03Contributing7 chapters
      1. 00Overview
      2. 01Finding a Project to Contribute To
      3. 02Your First Contribution, Step by Step
      4. 03How to Write a Bug Report That Gets Fixed
      5. 04Non-Code Contributions Maintainers Actually Want
      6. 05Getting Involved in the Open Source Community
      7. 06Building a Portfolio with Open-Source Contributions
      8. 07Overcoming Challenges in Open-Source Contributions
    4. 04Creating5 chapters
      1. 00Overview
      2. 01Choosing a Project Idea
      3. 02Planning Your Project
      4. 03Creating Your Project
      5. 04The Files That Turn a Repository Into a Project
      6. 05Community From Day One
    5. 05Licensing & Legal6 chapters
      1. 00Overview
      2. 01Choosing a License: Four Questions and a TableYou are here
      3. 02License Compatibility: What You Can Combine, and the Tools That Check
      4. 03Relicensing: The Source-Available Wave, and the Forks That Answered
      5. 04CLA or DCO: What You Sign When You Contribute
      6. 05Licenses for Things That Aren't Code: Docs, Fonts, Hardware, Data and Models
      7. 06Trademarks, Names and Logos: What Your License Doesn't Cover
    6. 06Maintaining9 chapters
      1. 00Overview
      2. 01What a Maintainer Actually Does
      3. 02Saying No: Five Replies That Keep Contributors Coming Back
      4. 03Reviewing Pull Requests: What to Check, What to Say, When to Close
      5. 04Running a Community Without It Running You
      6. 05Governance: Who Decides, and How to Write It Down
      7. 06Security for Maintainers: Before, During and After the First Report
      8. 07AI Crawlers and Your Project's Infrastructure
      9. 08Managing Project Dependencies
      10. 09Burnout, Succession and the End of a Project
    7. 07Promoting2 chapters
      1. 00Overview
      2. 01Introduction to Project Promotion
      3. 02Building a Strong Project Identity
    8. 08Financing3 chapters
      1. 00Overview
      2. 01Importance and Challenges of Financing Open-Source Projects
      3. 02Understanding Funding Models
      4. 03Effective Fundraising Strategies
    9. 09Open Source at Work2 chapters
      1. 00Overview
      2. 01License Compliance at Work: The Policy, the Notices and the SBOM
      3. 02Vulnerabilities in What You Ship: Triage, Upstream Fixes and the CRA
    10. 10Open Source & AI2 chapters
      1. 00Overview
      2. 01AI-Assisted Contributions: Write the Policy Your Project Needs
      3. 02Contributing with AI Tools Without Annoying Maintainers