[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Type](https://evolu.dev/docs/api-reference/common/Type) › Ulid

```ts
const Ulid: brand(
  "Ulid",
  String,
  (value: string) =>
    /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/u.test(value)
      ? ok()
      : err<UlidError>({ type: "Ulid", value }),
  formatUlidError,
);
```

Defined in: [packages/common/src/Type.ts:10765](https://github.com/evoluhq/evolu/blob/bc4578a260dd15d5bbf94b83765ca05984d194cb/packages/common/src/Type.ts#L10765)

ULID in its canonical uppercase text form, as defined by the [ULID
specification](https://github.com/ulid/spec).

Ulid accepts 26 characters of Crockford's Base32 alphabet: the digits and the
uppercase letters except I, L, O, and U. The characters spell 130 bits, and a
ULID has 128, so the first character is at most 7. Every 128-bit value has
exactly one Ulid.

The ULID specification reads ULIDs in any case. Ulid requires uppercase so
that equal ULIDs are equal strings; uppercase text from other sources before
validating it.

Convert a Ulid to an [Id](https://evolu.dev/docs/api-reference/common/Type/variables/Id) with [ulidToId](https://evolu.dev/docs/api-reference/common/Type/functions/ulidToId) and back with
[idToUlid](https://evolu.dev/docs/api-reference/common/Type/functions/idToUlid).

### Example

```ts
import { assertEqual, assertErr, assertOk, Ulid } from "@evolu/common";

const value = "01ARZ3NDEKTSV4RRFFQ69G5FAV";
assertOk(Ulid.fromUnknown(value), value);
assertErr(Ulid.fromUnknown("81ARZ3NDEKTSV4RRFFQ69G5FAV"));

const lowercase = value.toLowerCase();
const invalid = Ulid.fromUnknown(lowercase);
assertErr(invalid);
assertEqual(invalid.error, { type: "Ulid", value: lowercase });
assertOk(Ulid.fromUnknown(lowercase.toUpperCase()), value);
```