Skip to content
ZeroKit

Base64

Base64 is an encoding that turns arbitrary bytes into 64 printable characters so binary data can travel through text-only channels.

It works by taking 3 bytes at a time and mapping them onto 4 characters from A–Z, a–z, 0–9, + and /. Because 3 bytes become 4 characters, encoded data is about 33% larger than the original.

Base64 is not encryption: there is no key and decoding is a single step. Its real use is transport — attaching images to JSON, embedding data in an email or a data: URL, or storing bytes in a place that only accepts text.

A common bug is calling the browser's btoa() on non-ASCII text. btoa() throws on any character above U+00FF, so text has to be encoded to UTF-8 bytes first (TextEncoder) and then turned into a binary string.

Apply it: Base64 Encoder

Free Base64 encoder and decoder for text and files. Supports URL-safe Base64, live conversion and data URLs — everything runs in your browser, nothing is uploaded.

Open the free Base64 Encoder →
  • JSON — JSON (JavaScript Object Notation) is a text format for structured data built from objects,…
  • JWT — A JWT (JSON Web Token) is three Base64url segments — header, payload and signature — that …