Base64 Random ID Generator

Base64-encoded random bytes

Generating...

About

Base64 encoding uses 64 characters (A-Z, a-z, 0-9, +, /) to represent binary data. Base64 IDs are compact and efficient, using approximately 4/3 the size of the original binary data. They're widely used in web applications, APIs, and data transmission. Base64 is defined in RFC 4648 and is commonly used for encoding binary data in text-based protocols like JSON, XML, and URLs (with URL-safe variants).

Use Cases

  • Encoding binary data in JSON/XML
  • API responses and data transmission
  • Email attachments (MIME encoding)
  • Data URLs and embedded resources
  • Web storage and cookies
  • General-purpose binary-to-text encoding

How to Generate

Library

Native JavaScript (btoa/atob)

NPM Package

N/A - Native implementation

Code Example

// Native implementation
const bytes = new Uint8Array(18);
crypto.getRandomValues(bytes);
const binary = Array.from(bytes)
  .map(b => String.fromCharCode(b))
  .join('');
const base64Id = btoa(binary);