Base64 Encoder / Decoder
Encode text to Base64 or decode it back instantly — including URL-safe variants and automatic padding repair.
Mode
Your encoded output
Enter text to encode, or paste a Base64 string to decode it back to readable text.
How it works
Base64 turns any data into a string of 64 safe characters — A–Z, a–z, 0–9, plus and slash. It's how binary files travel through email, how small images get embedded in CSS, and how the payload of a JSON Web Token is carried inside a URL.
How it works
- Input is converted to bytes using UTF-8.
- Bytes are read in groups of three — 24 bits — and split into four 6-bit chunks.
- Each 6-bit chunk maps to one of 64 characters.
- Incomplete final groups are padded with
=.
Four output characters for every three input bytes is where the familiar 33% size increase comes from.
A worked example
Hi is two bytes: 72 and 105. In binary that's 01001000 01101001 — 16 bits, padded to 18 and split into three 6-bit chunks giving SGk=. The trailing equals sign records that the last group was short, so a decoder knows to discard the padding bits rather than emit a stray character.
How to interpret your result
Valid Base64 contains only the 64-character alphabet plus padding, and its length is a multiple of four. Decoded output that looks like gibberish usually means the original data was binary — an image or an archive — rather than text.
Common real-world uses
- Inspecting the payload of a JSON Web Token while debugging.
- Embedding small icons as data URIs in CSS or HTML.
- Building HTTP Basic Authentication headers for API testing.
- Passing structured data safely through text-only fields.
- Reading encoded values found in logs and webhooks.
Related tools: URL Encoder / Decoder · JSON Formatter & Validator · UUID Generator · File Size Converter