---
title: Grammar and comparison
description: Parse an IID on its first two colons, validate its shape, scheme and canonical value, and compare identifiers byte for byte.
url: https://docs.intuition.systems/docs/identifier/grammar
markdown_url: https://docs.intuition.systems/docs/identifier/grammar.md
version: V2
llms_index: https://docs.intuition.systems/llms.txt
kind: reference
reader:
  - app
  - agent
  - plugin
packages:
  - '@0xintuition/iid@0.1.1'
---

Every IID has the form `int:<scheme>:<value>`. This page lists the syntax, the parsing rule that implementations most often get wrong and the three checks that make an identifier valid. The grammar is frozen permanently: it will never change within this specification. [IID spec §1.5.1](https://github.com/0xIntuition/intuition-identifier/blob/3e593247c0e7cb168b37368937167ed146d3868a/spec/01-conformance.md#151-stability-guarantees)

## Syntax

```abnf
iid     = "int" ":" scheme ":" value

scheme  = 1*32 scheme-char
scheme-char = %x61-7A / DIGIT / "-"          ; a-z, 0-9, hyphen

value   = 1*220 value-char
value-char  = %x21-7E                         ; visible ASCII, no space
```

[IID spec §2.1](https://github.com/0xIntuition/intuition-identifier/blob/3e593247c0e7cb168b37368937167ed146d3868a/spec/02-grammar.md#21-syntax)

| Rule | Requirement |
| --- | --- |
| Prefix | Exactly `int:`, case-sensitive. `INT:` and `Int:` are not IIDs. |
| Scheme | 1–32 lowercase ASCII letters, digits or hyphens, and registered in the [scheme catalog](https://docs.intuition.systems/docs/identifier/schemes). |
| Value | 1–220 visible ASCII characters (`0x21`–`0x7E`). No spaces. |
| Total length | At most **256 bytes**. This is the binding limit. The per-part maxima cannot both be reached in one IID. |
| Non-ASCII text | Never appears raw. It enters only through a `gen1` hash or a scheme-specific encoding, such as percent-encoding in a URL. |

[IID spec §2.2](https://github.com/0xIntuition/intuition-identifier/blob/3e593247c0e7cb168b37368937167ed146d3868a/spec/02-grammar.md#22-requirements)

## Parse on the first two colons

A parser splits on the **first two colons only**. Everything after the second colon is the value, including any further colons. Splitting on every colon is the most common implementation error. A generic parser also does not interpret structure inside the value. Only the scheme's own rules do that. [IID spec §2.3](https://github.com/0xIntuition/intuition-identifier/blob/3e593247c0e7cb168b37368937167ed146d3868a/spec/02-grammar.md#23-parsing)

| IID | Scheme | Value |
| --- | --- | --- |
| `int:isbn:9780684832722` | `isbn` | `9780684832722` |
| `int:caip10:eip155:1:0xd8da6bf26964af9d7eed9e03e53415d37aa96045` | `caip10` | `eip155:1:0xd8da6bf26964af9d7eed9e03e53415d37aa96045` |
| `int:gen1:movie:r4:fb681afe7d438cad73ae90a70f1cc55a` | `gen1` | `movie:r4:fb681afe7d438cad73ae90a70f1cc55a` |
| `int:hash:sha256:…` | `hash` | `sha256:…` |

## Validate in three steps

A string is a valid IID only when all three checks pass, in this order. [IID spec §2.7](https://github.com/0xIntuition/intuition-identifier/blob/3e593247c0e7cb168b37368937167ed146d3868a/spec/02-grammar.md#27-reference-regular-expression)

1. **Shape.** Match the non-normative reference expression `^int:([a-z0-9-]{1,32}):([\x21-\x7E]{1,220})$` and check the 256-byte limit.
2. **Registered scheme.** Reject the IID if its scheme is not in the registry, even when the string is otherwise well-formed. The registry is closed. Validators never pass unknown schemes through. [IID spec §9.1](https://github.com/0xIntuition/intuition-identifier/blob/3e593247c0e7cb168b37368937167ed146d3868a/spec/09-registry-governance.md#91-the-registry)
3. **Canonical value.** Run the scheme's canonicalization and reject the IID if the value changes. A canonical value satisfies `canonicalize(value) = value`.

For example, `int:isbn:0-684-83272-0` is well-formed but invalid, because the canonical ISBN form is the 13-digit `9780684832722`. Canonicalize the raw ISBN first, then build `int:isbn:9780684832722`. [IID spec §2.5](https://github.com/0xIntuition/intuition-identifier/blob/3e593247c0e7cb168b37368937167ed146d3868a/spec/02-grammar.md#25-canonical-form)

## Compare byte for byte

Two IIDs are equal if and only if their byte sequences are identical. Comparison ignores no case, Unicode form or whitespace differences. Canonicalize **before** comparing, never during the comparison. Lowercasing a whole IID can change its meaning, because some schemes preserve case in their values. [IID spec §2.4](https://github.com/0xIntuition/intuition-identifier/blob/3e593247c0e7cb168b37368937167ed146d3868a/spec/02-grammar.md#24-comparison)

This makes a canonical IID a safe key for a unique database index or a cache. Two importers that canonicalize the same source value produce identical text. [IID spec §8.2](https://github.com/0xIntuition/intuition-identifier/blob/3e593247c0e7cb168b37368937167ed146d3868a/spec/08-equivalence.md#82-three-layers)

## Relationship to URNs

The grammar follows URN discipline without claiming RFC 8141 conformance. RFC 8141 treats some parts of a URN as case-insensitive, which conflicts with byte-exact comparison. Where a URN is required, map `int:<scheme>:<value>` to `urn:int:<scheme>:<value>` and back without changing the value. [IID spec §2.6](https://github.com/0xIntuition/intuition-identifier/blob/3e593247c0e7cb168b37368937167ed146d3868a/spec/02-grammar.md#26-relationship-to-urns)

## Related

- [Scheme catalog](https://docs.intuition.systems/docs/identifier/schemes) lists every registered scheme with an input and its canonical IID.
- [Conformance and test vectors](https://docs.intuition.systems/docs/identifier/conformance) explains how to check a validator against the published vectors.
- [Schemes and canonical form](https://docs.intuition.systems/docs/concepts/iid-schemes) applies these rules to a recording identifier.

Applies to V2 · `@0xintuition/iid` 0.1.1
