[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) › Uuid

```ts
const Uuid: brand(
  "Uuid",
  String,
  (value: string) =>
    /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/u.test(
      value,
    )
      ? ok()
      : err<UuidError>({ type: "Uuid", value }),
  formatUuidError,
);
```

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

UUID in its canonical lowercase text form, as defined by [RFC
9562](https://www.rfc-editor.org/rfc/rfc9562).

Uuid accepts 32 lowercase hexadecimal digits in the 8-4-4-4-12 layout, as
produced by `crypto.randomUUID()`. It accepts every version and variant,
including the Nil and Max UUIDs, so every 128-bit value has exactly one
Uuid.

RFC 9562 reads UUIDs in any case. Uuid requires lowercase so that equal UUIDs
are equal strings; lowercase text from other sources before validating it.

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

### Example

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

const value = "0190a6f4-8c3e-7b2a-9d41-5e6f7a8b9c0d";
assertOk(Uuid.fromUnknown(value), value);

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