# b64id

> url-safe 128-bit UUID strings expressed in base-64 encoding

Latest version **1.1.1** (published 2026-01-10) · ISC license · 0 weekly downloads

## Install

```sh
npm install b64id
pnpm add b64id
yarn add b64id
bun add b64id
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 1.1.1 |
| Published | 2026-01-10 |
| First published | 2019-03-25 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Luis Montes |
| Maintainers | monteslu |
| Keywords | base64, base64-url, uuid, guid |

## Links

- npm: https://www.npmjs.com/package/b64id
- Repository: https://github.com/monteslu/b64id
- Homepage: https://github.com/monteslu/b64id#readme
- Issues: https://github.com/monteslu/b64id/issues
- npm.io page: https://npm.io/package/b64id

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.1.1 (latest) — 2026-01-10
- 1.1.0 — 2026-01-10
- 1.0.1 — 2023-06-05
- 1.0.0 — 2019-03-25

## README

# b64id

[![NPM](https://nodei.co/npm/b64id.png?compact=true)](https://nodei.co/npm/b64id/)

[![CircleCI](https://circleci.com/gh/monteslu/b64id.svg?style=svg)](https://circleci.com/gh/monteslu/b64id)

## Why ?

A [uuid](https://en.wikipedia.org/wiki/Universally_unique_identifier) is a unique identifier typically expressed as something like: `88982e7e-c87c-4758-abf2-6a36a8c3e0e0` that's too many characters!

We could instead express the same amount of data in a url-friendly way such as: `iJgufsh8R1ir8mo2qMPg4A`

**Zero dependencies** - uses native `crypto.randomUUID()`, `btoa()`, and `atob()`. Works in Node.js 16+ and all modern browsers.



## How ?

If we want to generate a url-safe, base64 encoded id: 

```javascript
import b64id from 'b64id';

const id = b64id.generateId();

console.log(id); //something like: xrps2KrvTBuim1y6h-KoiA
```


To convert a standard uuid to url-safe, base64 format: 

```javascript

const id = b64id.uuidToB64('c6ba6cd8-aaef-4c1b-a29b-5cba87e2a888');

console.log(id); //something like: xrps2KrvTBuim1y6h-KoiA
```


To convert a url-safe, base64 id back to standard uuid format: 

```javascript

const id = b64id.b64ToUuid('xrps2KrvTBuim1y6h-KoiA');

console.log(id); //something like: c6ba6cd8-aaef-4c1b-a29b-5cba87e2a888
```

---
_Source: https://npm.io/package/b64id · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
