Base64 Encode & Decode

Encode text to Base64 or decode Base64 back to text, with full UTF-8 and URL-safe Base64 support.

Result
SGVsbG8sIHdvcmxkISBHcsO8w59lIPCfkYs=
Input size
26 bytes
Output size
36 bytes
Size in bytes
InputInput — Bytes: 2626OutputOutput — Bytes: 3636

Runs entirely in your browser. Nothing you enter is uploaded.

Formula

3 bytes (24 bits) → 4 characters of 6 bits eachEncoded length = 4 × ⌈bytes ÷ 3⌉

How it works

Base64 represents arbitrary bytes using only 64 safe characters: A–Z, a–z, 0–9, + and /. Every 3 bytes of input become 4 characters, so encoded data is about a third larger. The = signs at the end are padding that makes the length a multiple of four.

Text is first converted to UTF-8 bytes, so accented letters, Chinese characters and emoji round-trip correctly — the browser's built-in btoa() fails on these. When decoding, the tool accepts both alphabets, missing padding and stray whitespace or line breaks, which is common in emails and PEM files.

The URL-safe variant (Base64URL) swaps + and / for - and _ and drops the padding, so the result can sit in a URL or file name without escaping. JSON Web Tokens use it.

Base64 is an encoding, not encryption: anyone can decode it. Encoding and decoding happen in your browser, so secrets you paste are not sent anywhere — but do not rely on Base64 to hide them.

Frequently asked questions

Why does decoding give an error about UTF-8?

The Base64 holds binary data — an image, PDF or compressed file — rather than text. The bytes decoded correctly but cannot be shown as characters.

Why is Base64 used at all?

Many systems — email, JSON, URLs, HTML attributes — only handle text safely. Base64 lets you carry binary data such as images or keys through them without corruption.

How much bigger does Base64 make data?

About 33% larger, plus up to two padding characters. A 3 MB image becomes roughly 4 MB of Base64.

esc