Open Source License Generator

Pick a license, enter the year and copyright holder, then download the complete LICENSE file and copy the matching per-file header.

e.g. 2026 or 2019-2026
SPDX identifierMIT

MIT License (MIT) — Short and permissive: anyone may reuse the code, including in closed-source products, as long as the copyright and license notice are kept.

LICENSE file (full text)

Source file header

// SPDX-License-Identifier: MIT
// Copyright (c) 2026 Your Name

License texts are reproduced verbatim from their official sources. This tool is not legal advice — for commercial or dual-licensing questions, ask a lawyer.

What This License Generator Does

Code published without a license is not open source: by default copyright law reserves all rights to the author, so nobody can legally reuse it. Adding a LICENSE file to the root of your repository fixes that. This tool produces the complete, official text of the nine most common open source licenses, fills in your name and year where the license expects them, and generates the short header you can paste at the top of each source file.

Short licenses (MIT, ISC, BSD, Unlicense) contain the copyright line inside the LICENSE file itself. Long licenses (Apache 2.0, GPL, AGPL, MPL) are distributed unmodified; for those the copyright line lives in the per-file notice, exactly as each license's own "how to apply" appendix recommends.

How to Use It

  1. Choose a license in the License menu. A one-line summary appears below the controls.
  2. Enter the Year (a single year or a range such as 2019-2026) and the Copyright holder — your name or your organization.
  3. For GPL or AGPL, pick Version 3 or any later version or Version 3 only. The SPDX identifier updates to match.
  4. Click Download LICENSE and commit the file to the root of your repository.
  5. In Source file header, choose your language's comment style and click Copy header to paste it at the top of your files.

Example: an MIT Header

With MIT, year 2026, holder Jane Doe and the // comment style, the header box contains:

// SPDX-License-Identifier: MIT
// Copyright (c) 2026 Jane Doe

Also set "license": "MIT" in package.json (or the equivalent field in pyproject.toml, Cargo.toml, etc.) so registries display it.

License Comparison

LicenseTypePatent grantAttributionSame license required forTypical use
MITPermissiveNoKeep copyright + license noticeNoLibraries, small tools, maximum adoption
ISCPermissiveNoKeep copyright + license noticeNoSame as MIT; npm default
BSD 2-ClausePermissiveNoKeep notice in source and binary docsNoLike MIT, older academic style
BSD 3-ClausePermissiveNoSame as BSD-2 + no endorsementNoWhen you want to protect your name
Apache 2.0PermissiveYes (explicit)Keep notices, NOTICE file, mark changed filesNoCompany-backed projects, patent concerns
MPL 2.0Weak copyleft (per file)Yes (explicit)Keep noticesModified MPL files onlyMixing open and proprietary files
GPL v3Strong copyleftYes (explicit)Keep noticesWhole program when distributedApps that must stay free software
AGPL v3Strong copyleft + networkYes (explicit)Keep noticesWhole program, also when offered over a networkServer software / SaaS
UnlicensePublic domainNoNoneNoSnippets, examples, giving code away

"No" in the patent column means the license has no explicit patent clause; some lawyers argue MIT and BSD imply one, but it is not written down.

Which License Should I Pick?

  • You want the widest possible use: MIT. It is short, well understood and accepted by almost every company.
  • Contributors from companies, or patents matter: Apache 2.0. The explicit patent grant is why many corporate projects prefer it.
  • Improvements must come back to the community: GPL v3. Anyone distributing a modified version must publish its source.
  • It is a web service: AGPL v3, because the GPL does not cover software that is only used over a network.
  • A library that companies may embed but whose own files should stay open: MPL 2.0.
  • You do not care at all: the Unlicense (or MIT if your company forbids public-domain dedications).

Limitations

  • The tool does not check compatibility with your dependencies. You cannot release a project that bundles GPL code under MIT, for example.
  • You can only license code you own. Changing the license of a project with outside contributors usually needs their agreement.
  • LGPL and Creative Commons licenses are not included; Creative Commons licenses are not designed for software.
  • This page is general information, not legal advice.

Tips

  • Name the file exactly LICENSE (or LICENSE.md/COPYING) so GitHub and GitLab detect it.
  • Mention the license at the end of your README — the README Generator adds a License section and badge for you.
  • Keep the year as the first publication year or a range; you do not need to update it every January.
  • Starting a new repository? Pair the license with a .gitignore for your stack.

Frequently Asked Questions

Which licenses does the generator support?

MIT, Apache 2.0, GNU GPL v3, GNU AGPL v3, Mozilla Public License 2.0, BSD 2-Clause, BSD 3-Clause, ISC and the Unlicense. Each one is produced as its complete official text, ready to save as a LICENSE file.

What is the difference between MIT and Apache 2.0?

Both are permissive. Apache 2.0 adds an explicit patent license from every contributor, terminates that patent license for anyone who sues over patents in the work, and requires modified files to carry a notice that they were changed.

Should I choose GPL-3.0-only or GPL-3.0-or-later?

"Or later" lets people use your code under future GPL versions published by the Free Software Foundation, which keeps it compatible with projects that move to a newer version. "Only" locks it to version 3. The LICENSE text is the same; only the file header and the SPDX identifier change.

Why isn't my name inside the Apache or GPL LICENSE file?

Those licenses are meant to be distributed unmodified. Your copyright line goes in the short notice at the top of each source file (the 'Source file header' box), and for Apache optionally in a NOTICE file.

What is an SPDX license identifier?

A standard short name such as MIT or GPL-3.0-or-later. Adding a line like SPDX-License-Identifier: MIT to each file and "license": "MIT" to package.json lets scanners and package registries detect your license automatically.

Is anything I type sent to a server?

No. The license texts are bundled with the page and filled in by JavaScript in your browser. Your name and project details are never uploaded.

Is this legal advice?

No. The tool reproduces the official license texts and summarises their main differences. For questions about commercial use, dual licensing or relicensing existing code, consult a lawyer.