Base64 Encoder & Decoder

Encode text to Base64 or decode Base64 strings back to plain text.

FreeNo signupRuns in browser
Plain text
Base64
Advertisement

What is Base64?

Encoding scheme

Base64 converts binary data to a text string using 64 printable ASCII characters. It's standard in APIs, data URIs, and email attachments.

Common use cases

Embedding images in CSS/HTML as data URIs, passing binary data in JSON payloads, Basic Auth headers, and JWT token payloads.

Not encryption

Base64 is encoding, not encryption. It's easily reversible and provides no security. Never use it to "hide" sensitive data.

Base64 Encoding Explained — How It Works and Where It Is Used

Base64 encoding converts binary data into a string of 64 printable ASCII characters. The name comes directly from this: base 64 means each character represents 6 bits of data (2⁶ = 64). It was invented to solve a real problem — early internet protocols like email were text-only, but people needed to send binary files like images and documents. Base64 made binary data look like text.

How Base64 works

The encoder takes 3 bytes (24 bits) of input and splits them into four 6-bit groups. Each group maps to one of 64 characters: A–Z (26), a–z (26), 0–9 (10), plus two special characters (+ and /). This is why Base64 output is always 4/3 the size of the input. If the input isn't divisible by 3, padding characters (=) fill the gap.

Real-world uses today

HTTP Basic Authentication encodes username:password as Base64 in the Authorization header. JWT tokens encode their header and payload as Base64URL. CSS data URIs embed images directly in stylesheets as Base64 strings. JSON APIs use Base64 to include binary data (images, files) without needing multipart form encoding. Email attachments travel as Base64-encoded MIME parts.

Base64 is not encryption

This is the most important thing to understand: Base64 is encoding, not encryption. Decoding is instant and requires no key. Never use Base64 to "hide" passwords, API keys, or sensitive data. It provides zero security — it's purely a text-safe transport format.

Frequently asked questions

What is Base64 encoding and how does it work?
Base64 is an encoding scheme that converts binary data into a string of 64 printable ASCII characters (A–Z, a–z, 0–9, +, /). It works by taking 3 bytes of input and converting them to 4 characters. It's widely used because it allows binary data to be safely transmitted over text-based protocols.
How do I encode text to Base64 online?
Click "Encode → Base64" at the top, paste your plain text in the left panel, and click the Encode button. The Base64 encoded string appears instantly on the right. Click Copy to grab it. The entire process runs in your browser — no data is uploaded.
How do I decode a Base64 string back to text?
Click "Decode ← Base64" to switch modes, paste your Base64 string in the left panel, and click Decode. The original plain text is shown on the right. This works for any standard Base64 encoded string including those with padding (==) characters.
Why does my Base64 output end with == or = signs?
Base64 encodes data in groups of 3 bytes, converting each group to 4 characters. If the input length isn't a multiple of 3, padding characters (=) are added to complete the final group. One = means 1 byte of padding, == means 2. This is completely normal and expected.
Is Base64 encoding the same as encryption?
No. Base64 is encoding, not encryption. It provides zero security — anyone can decode it instantly. It's designed for safely transmitting binary data over text protocols, not for hiding or protecting data. For security, use proper encryption like AES.
Where is Base64 commonly used in web development?
Base64 is used in: HTTP Basic Authentication headers (encoding username:password), JWT (JSON Web Token) payloads, embedding images as data URIs in CSS and HTML, encoding binary data inside JSON API payloads, and storing binary content in databases that only support text.