SPDX

Also known as: Software Package Data Exchange

On this page 7

SPDX, the Software Package Data Exchange, is an open standard for communicating license, copyright and component information about software in a consistent, machine-readable form. In software licensing, it provides two things that practitioners use daily: a curated list of standardized license identifiers such as MIT or Apache-2.0, and a document format for software bills of materials that records what a package contains and under which terms.

The project is hosted by the Linux Foundation and its specification was published as the international standard ISO/IEC 5962:2021. Because the identifiers are short, unambiguous and stable, they have become the common vocabulary used by package managers, code hosting platforms and license compliance tools.

What problem SPDX solves

SPDX exists because free-text license descriptions are ambiguous. Before standard identifiers, the same license appeared as “GPL”, “GNU GPL v2”, “GPLv2+” or a pasted license text with small edits, and tools could not reliably tell whether two declarations meant the same thing. A modern application can include hundreds or thousands of open source components, so manual interpretation does not scale.

The standard addresses this at two levels. At the file level, a one-line SPDX license identifier states the license of a source file precisely. At the package or product level, an SPDX document describes components, their relationships, checksums, suppliers and licenses, so that recipients can verify license obligations and supply chain integrity without reading every file.

SPDX license identifiers and expressions

The SPDX License List assigns each recognized license a short identifier and a canonical text. Developers place the identifier in a source file comment using the tag SPDX-License-Identifier:, which tools can detect without interpreting the license text. The table below shows typical identifiers and what they denote.

IdentifierLicenseNotes
MITMIT LicenseShort permissive license
Apache-2.0Apache License 2.0Permissive with a patent grant
GPL-2.0-onlyGNU GPL version 2 onlyExcludes later versions
GPL-3.0-or-laterGNU GPL version 3 or any laterAllows upgrade to newer versions
MPL-2.0Mozilla Public License 2.0File-level copyleft
BSD-3-ClauseBSD three-clause licensePermissive with a non-endorsement clause
Examples of SPDX license identifiers

The distinction between -only and -or-later is deliberate. Older identifiers such as GPL-2.0 were deprecated because they did not state whether the licensor allowed later versions, which is a legally significant difference for license compatibility.

When one license is not enough, SPDX license expressions combine identifiers with operators. The following table explains the operators.

OperatorMeaningExample
ORRecipient may choose one licenseMIT OR Apache-2.0
ANDAll listed licenses apply togetherMIT AND BSD-3-Clause
WITHLicense plus a named exceptionGPL-2.0-only WITH Classpath-exception-2.0
LicenseRef-Custom license not on the listLicenseRef-Internal-EULA
Operators in SPDX license expressions

The OR operator expresses dual licensing, a common pattern in ecosystems such as Rust, while the WITH operator records license exceptions such as linking exceptions without inventing a new license name.

SPDX documents and the software bill of materials

An SPDX document is a structured description of a software package or product, and it is one of the two dominant SBOM formats, alongside CycloneDX. It records packages, files and snippets, together with versions, suppliers, download locations, cryptographic checksums, concluded and declared licenses, copyright texts and relationships such as “contains” or “depends on”.

Version SPDX 2.x supports tag-value, JSON, YAML, RDF/XML and spreadsheet serializations. SPDX 3.0, released in 2024, reorganized the model into profiles covering software, security, build, AI and dataset information, and uses JSON-LD as its main serialization. The table below compares the two generations.

AspectSPDX 2.xSPDX 3.0
StructureSingle document modelModular profiles
Main formatsTag-value, JSON, YAML, RDF/XMLJSON-LD
ScopeLicensing and packagesAdds security, build, AI and datasets
StandardizationBasis of ISO/IEC 5962:2021Newer community specification
Tool supportVery broadGrowing
SPDX 2.x compared with SPDX 3.0

Regulatory interest has made SBOMs more important. Public procurement rules and product security legislation increasingly expect suppliers to deliver an SBOM with software, and SPDX is one of the formats generally accepted for that purpose.

Using SPDX in a project

Adopting SPDX in practice starts with consistent identifiers in every source file and in the package manifest. Package managers such as npm, Cargo and Maven accept SPDX expressions in their license fields, and code hosting platforms use them to display and filter repository licenses.

  1. Add an SPDX-License-Identifier line to the header of each source file.
  2. Declare the project license as a valid SPDX expression in the package manifest.
  3. Keep full license texts in a dedicated folder, as recommended by the REUSE specification.
  4. Generate an SPDX SBOM in the build pipeline so it always matches the released artifact.
  5. Validate documents with an SPDX validator before distribution.

Automation is the key benefit. Compliance scanners compare declared identifiers with detected license texts, flag incompatible combinations such as GPL code inside a proprietary product, and produce attribution notices automatically.

Limitations and common mistakes

SPDX standardizes how license information is expressed, not whether that information is correct. A file can carry a wrong identifier, and an SBOM is only as reliable as the scanner and the human review that produced it. SPDX is not a legal opinion, and it does not resolve compatibility questions on its own.

  • Using deprecated identifiers such as GPL-2.0 leaves version intent unclear.
  • Confusing declared and concluded licenses hides discrepancies found during review.
  • Writing “MIT/Apache” instead of a valid expression breaks automated parsing.
  • Generating an SBOM once and never updating it makes it obsolete after the next release.
  • Inventing identifiers instead of using the LicenseRef- prefix produces invalid documents.

The simple explanation

SPDX is a shared naming system for software licenses plus a standard way to write an ingredient list for software. Instead of describing a license in a long sentence that people might read differently, a developer writes a short code such as “MIT” or “Apache-2.0” that everyone and every tool understands the same way.

It works much like the ingredient label on food packaging. The label lists what is inside and any warnings, in a fixed format. An SPDX document is the ingredient label of a software product, showing which parts it contains and which rules apply to each.

How it is used in practice

A company that builds network equipment ships firmware containing roughly 900 open source components. A large customer requires an SBOM with every release. The engineering team adds an SBOM generator to its build pipeline, which produces an SPDX JSON document listing every package, its version, its checksum and its license expression.

During one release, the compliance scanner flags a newly added library declared as GPL-3.0-only inside a component that the company distributes under proprietary terms. The team replaces the library with an alternative licensed under BSD-3-Clause before shipping. The customer receives a validated SBOM, and the company avoids a license conflict before it reaches the market.