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

```ts
function ulidToId<B extends string = never>(
  value: string & Brand<"Ulid">,
  ..._validation: IdBrandValidation<B>
): CreatedId<B>;
```

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

Converts a [Ulid](https://evolu.dev/docs/api-reference/common/Type/variables/Ulid) to the [Id](https://evolu.dev/docs/api-reference/common/Type/variables/Id) with the same 16 bytes.

Use this to store records whose external keys are ULIDs. Unlike
[createIdFromString](https://evolu.dev/docs/api-reference/common/Type/functions/createIdFromString), the mapping is reversible with [idToUlid](https://evolu.dev/docs/api-reference/common/Type/functions/idToUlid), so
the original ULID does not need its own column. The first 6 bytes of a ULID
are its creation time, which the Id keeps.

### Example

```ts
import {
  assertEqual,
  assertType,
  idToUlid,
  Ulid,
  ulidToId,
  type Brand,
  type Id,
} from "@evolu/common";

const ulid = Ulid.orThrow("01ARZ3NDEKTSV4RRFFQ69G5FAV");
const todoId = ulidToId<"Todo">(ulid);

assertEqual(todoId, "AVY-OrXT1nZMYe-5kwK9Ww");
assertType<typeof todoId, Id & Brand<"Todo">>();
assertEqual(idToUlid(todoId), ulid);
```