---
id: "ulid"
kind: "datatype"
status: "stable"
is_pii: false
categories: ["identifiers"]
langs: ["common"]
quality: 90
url: "http://registry.apicrafter.io/datatype/ulid"
---

# ULID (Universally Unique Lexicographically Sortable Identifier) (`ulid`)

128-bit identifier from the ULID specification. The first 48 bits are the Unix time in milliseconds and the other 80 bits are random, so values sort by creation time. The canonical form is 26 characters of Crockford's Base32 (digits and uppercase letters without I, L, O and U), 10 for the time and 16 for the randomness. The first character is 0 to 7, because 26 characters hold 130 bits and the largest ULID is 7ZZZZZZZZZZZZZZZZZZZZZZZZZ. The specification calls ULIDs case-insensitive; the regexp accepts the canonical uppercase form. A ULID has the same size as a UUID and is often stored in a UUID column.

- Personal data (PII): no
- Categories: Universal unique identifiers (identifiers)
- Countries: global
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^[0-7][0-9A-HJKMNP-TV-Z]{25}$
```

## Examples

- `01ARZ3NDEKTSV4RRFFQ69G5FAV` — Example of the ULID specification, created 2016-07-30
- `01AN4Z07BY79KA1307SR9X4MV3` — Example of the timestamp and randomness parts in the ULID specification
- `7ZZZZZZZZZZZZZZZZZZZZZZZZZ` — Largest valid ULID
- `8ZZZZZZZZZZZZZZZZZZZZZZZZZ` (invalid example) — Exceeds 128 bits
- `01ARZ3NDEKTSV4RRFFQ69G5FAU` (invalid example) — The letter U is not in Crockford's Base32
- `01ARZ3NDEKTSV4RRFFQ69G5FA` (invalid example) — 25 characters

## Metacrafter rules

2 rules: 1 match the field name, 1 match values.

- `ulidfield` (field, `basic/identifiers.yaml`)
- `ulidvalue` (data, `basic/identifiers.yaml`)

## Supported by tools

- `metacrafter`

## Translations

- ru: ULID (универсальный уникальный лексикографически сортируемый идентификатор): 128-битный идентификатор из 48 бит времени Unix в миллисекундах и 80 случайных бит. Записывается 26 символами Base32 Крокфорда; значения сортируются по времени создания.

## Sources

- doc: <https://github.com/ulid/spec>
- wikidata: <https://www.wikidata.org/wiki/Q114247076>
- doc: <https://www.crockford.com/base32.html>

## Quality

Score 90/100. Missing: mapping (Wikidata, Schema.org, ...).

JSON: <http://registry.apicrafter.io/api/v1/datatypes/ulid.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/identifiers/ulid.yaml>
