Base64 EncoderㆍDecoder

Encode or decode text and files with Base64. Auto-detects whether your input is already encoded.

Input
Output

What is Base64?

Base64 is an encoding that represents binary data using only ASCII characters (A-Z, a-z, 0-9, +, /). It is commonly used in email, data URIs, JWTs, and API responses.

Smart Input Detection

When you paste text, the tool checks whether it looks like Base64 (valid charset + length divisible by 4) and switches to Decode mode automatically.

Privacy

All text and files are processed locally in your browser. Nothing is uploaded, so sensitive tokens and credentials stay safe.

How the encoding actually works

Base64 takes three bytes (24 bits) of binary input at a time and rewrites them as four 6-bit groups, each represented by one printable ASCII character. The character set is defined in RFC 4648, the authoritative standard. If the input length is not a multiple of 3 bytes, the output is padded with one or two = characters so that every encoded string is always a multiple of 4. That is why a rough-but-reliable validity check is "does the length divide by 4 and does every character belong to [A-Za-z0-9+/=]?".

Where you encounter Base64 every day

Base64 vs Base64URL - pick the right flavor

Standard Base64 uses +, /, and =. Two of those characters have special meaning in URLs (+ decodes to a space; / is a path separator), so embedding raw Base64 in a query string often corrupts the payload. The fix is Base64URL (also RFC 4648, §5), which substitutes + → - and / → _, and usually omits the = padding. Rule of thumb:

When NOT to use Base64

Troubleshooting common decode errors

Performance notes for developers

Encoding and decoding are O(n) operations and extremely fast - a 1 MB file encodes in roughly a millisecond on a modern laptop. The real cost is the 33% size increase and the fact that Base64 strings are not compressible as efficiently as the original binary (the alphabet lacks the low-frequency bytes that compression algorithms rely on). If your binary payloads are large enough for size to matter, skip Base64 entirely and use a binary-aware transport.

When working with JSON API payloads, the JSON Formatter & Converter helps you inspect and tidy the data. For collision-resistant resource identifiers, the UUID Generator is a cleaner alternative to Base64-encoded IDs.

FAQ

Is Base64 encryption?

No. It is just an encoding and anyone can decode it. Do not use it to protect passwords.

How much larger does data get?

Base64 encoding increases size by about 33%.

Can I use Base64 directly in URLs or filenames?

Standard Base64 uses `+`, `/`, and `=` which conflict with URL syntax. Use "URL-safe Base64" (Base64URL) which replaces `+` with `-` and `/` with `_`.