SPDX License IDs

Use SPDX short-form identifiers to communicate license information in a simple, efficient, portable and machine-readable manner.

Key takeaways and best practices

  • Add an SPDX license ID single-line comment to every source file, wherever reasonably possible.

  • Use AND, OR, WITH and + operators to communicate combinations of licenses.

  • For license texts that aren’t on the SPDX License List, use LicenseRef- and AdditionRef- to create your own custom IDs.

Overview

A project’s license information can be challenging to track, because it may be stored in many different locations, such as:

  • a LICENSE text file in the project’s root directory

  • metadata for the project’s entry with a package manager

  • a written text description in a README file

  • a written text description in one or more source code files

  • and other places…

In addition, particular files may have a license that differs from the project’s “overall” license in its LICENSE file; or may have different licenses based on their location or document type.

To help with making license information more human- and machine-readable, use SPDX short-form license IDs in your source code (and other) files. These consist of a single line in the form described on the following pages.

Details