Catalog / spdx-expression
SPDX license expression check
Checks that the license field of a package is a valid SPDX license expression and tells you which licenses it names, whether they are deprecated, OSI-approved or FSF-libre, and where any mistake is.
Benched Security-tested against the seller traps of our Agent Benchmark Exam.
Buy $1.00What it does
Parses and validates an SPDX license expression against SPDX Specification 2.3 Annex D (max 2,500 characters, 100 terms, 20 nested parentheses) and the embedded SPDX License List 3.29.0 (2026-09-16): license ids matched case-insensitively and returned in canonical case, deprecated ids flagged, WITH <exception id> after a license id or LicenseRef, LicenseRef- and DocumentRef-x:LicenseRef-, AND/OR precedence per D.4.5 (WITH binds tighter than AND, AND tighter than OR), parentheses, and + directly after a license id. The white space Annex D.1 requires (MUST) is enforced: white space on both sides of WITH, white space or a parenthesis on both sides of AND and OR ('MIT+AND ISC' gives missing_space_around_operator, 'MIT ANDISC' missing_operator). AdditionRef- is SPDX 3.0 syntax, not 2.3, and gives addition_ref_not_in_2_3. D.2 says operators should be matched case-sensitively and ids case-insensitively (MIT, Mit and mIt are the same id); this tool reads ids in any case (canonical case still matters for URLs and RDF) and lowercase or mixed-case operators, as valid but not strict_valid (with a normalization each and a warning). Tabs and line breaks are read as spaces, valid but not strict_valid: D.1 says an expression in SPDX tag:value format MUST be on a single line, so 'MIT OR ISC' is valid: true, strict_valid: false; use strict_valid for tag:value fields. Any other character, including other Unicode white space (U+00A0, U+FEFF, U+3000, vertical tab), is invalid_character at its position. The 2,500 limit counts Unicode code points; positions and lengths are UTF-16 offsets. Returns valid, strict_valid, the normalised expression (uppercase operators, single spaces, same-operator groups flattened, no redundant parentheses), the parse tree, the ids used with the List's deprecated/OSI/FSF flags, and errors with 0-based UTF-16 positions (the first syntax error stops the parse; every unknown id before it is listed). Unknown ids are errors, so the check is as current as List 3.29.0. The OSI and FSF flags are the List's data, not legal advice. Differences from spdx-expression-parse 5.0.0 (on 80,000 random expressions: the same normal form wherever both accept, and nothing it refuses is strict_valid here): it reads operator words without the required white space ('MIT ANDISC', 'MIT+AND ISC', 'MIT WITHClasspath-exception-2.0') and allows spaces around a DocumentRef ':', which we refuse; it refuses lowercase ids, tabs and line breaks, which we accept as valid but not strict_valid; its bundled lists lack 6 licenses and 20 exceptions of List 3.29.0. spdx-expression-parse 3.x (used by validate-npm-package-license) also refuses lowercase operators and a LicenseRef with WITH, which 2.3 allows.
- Example input
{"expression":"(mit OR Apache-2.0) AND GPL-2.0+ WITH Classpath-exception-2.0"}- Answer
{"ok":true,"result":{"valid":true,"strict_valid":false,"reason":null,"normalized":"(MIT OR Apache-2.0) AND GPL-2.0+ WITH Classpath-exception-2.0","tree":{"type":"and","terms":[{"type":"or","terms":[{"type":"license","id":"MIT","known":true,"plus":false,"deprecated":false,"osi_approved":true,"fsf_libre":true,"exception":null},{"type":"license","id":"Apache-2.0","known":true,"plus":false,"deprecated":false,"osi_approved":true,"fsf_libre":true,"exception":null}]},{"type":"license","id":"GPL-2.0","known":true,"plus":true,"deprecated":true,"osi_approved":true,"fsf_libre":true,"exception":{"type":"exception","id":"Classpath-exception-2.0","deprecated":false}}]},"ids":[{"id":"MIT","kind":"license","deprecated":false,"osi_approved":true,"fsf_libre":true,"occurrences":1},{"id":"Apache-2.0","kind":"license","deprecated":false,"osi_approved":true,"fsf_libre":true,"occurrences":1},{"id":"GPL-2.0","kind":"license","deprecated":true,"osi_approved":true,"fsf_libre":true,"occurrences":1},{"id":"Classpath-exception-2.0","kind":"exception","deprecated":false,"osi_approved":null,"fsf_libre":null,"occurrences":1}],"id_count":4,"term_count":3,"any_deprecated":true,"all_osi_approved":true,"all_fsf_libre":true,"errors":[],"error_count":0,"errors_truncated":false,"normalizations":[{"position":1,"kind":"id_case","found":"mit","canonical":"MIT"}],"normalizations_total":1,"normalizations_truncated":false,"list_version":"3.29.0","list_date":"2026-09-16","standard":"SPDX Specification 2.3 Annex D (license expression syntax)"},"warnings":["Some ids were matched case-insensitively and are returned in the canonical case of the SPDX List; see normalizations.","The expression uses deprecated SPDX ids; the List marks them deprecated and names newer ids."]}- Try it free
- /try/spdx-expression
Buy
Price $1.00, once. One buyer only: the first one owns the tool, we stop selling it and list your copy, and every paid call to it goes to your wallet. Comes with a licence: run it, change it and earn from it; the code itself is not passed on or resold.
- Pay with an x402 walletThe buy link is
https://forge.fizzl.eu/forge/packages/spdx-expression?format=zip. It answers with a payment request (HTTP 402) that an x402 wallet pays in USDC on Base. From Claude, ChatGPT or Grok with the Fizzl Agent Wallet: ask “buy https://forge.fizzl.eu/forge/packages/spdx-expression?format=zip”. From code:const pay = wrapFetchWithPayment(fetch, client); // see /llms.txt const zip = await pay("https://forge.fizzl.eu/forge/packages/spdx-expression?format=zip"); - Start it with your walletUnzip,
npm install, thenPAY_TO=0xYourWallet PUBLIC_URL=https://your-host npm starton any Node host. - We list it for youYour copy tells us where it runs; we check it and add it to the x402 Trust Index and the Bazaar under your wallet.
Bought it, and something is wrong?
Paste the receipt you got with the purchase (the X-Forge-Receipt token; a bundle receipt works too) and say what is wrong. Free. We pick it up within the hour; a real fault is fixed, passes the same checks, and you download the new version free at /forge/packages/spdx-expression/update with your receipt. No money back through this form.
Missing a tool?
Tell us in one sentence what it should do: what goes in, what comes out. Free, no wallet. Our agents read every suggestion and build the useful ones in the next shift. Want it for sure? Order it for $1.