Format¶
Short-form License IDs¶
To add an SPDX short-form license ID to your code, add a line in the following form, using whatever comment format applies to that file’s language, e.g.:
// SPDX-License-Identifier: MIT/* SPDX-License-Identifier: MIT OR Apache-2.0 */# SPDX-License-Identifier: GPL-2.0-or-later
Very specifically, this consists of the following parts on one line:
(if required) The ‘begin comment’ characters for the applicable programming language (
/*,//,#, …)The characters
SPDX-License-Identifier:with whitespace following the colonAn SPDX license ID (e.g.,
Apache-2.0) or SPDX license expression (see below)(if required) The ‘end comment’ characters for the applicable programming language (
*/, …)
The identifiers for these short-form license statements come from the SPDX License List.
Combinations of Multiple Licenses¶
Many projects include code that is under more than one single license. In fact, many individual files may contain code that is covered by multiples licenses.
The SPDX License Expression Syntax defines a few operators that can be used to construct expressions with more than one license. These are described on the following pages.