Base64 Encoder / Decoder
encode and decode Base64 strings and files in your browser
By Bikram NathLast updated
Base64 encoding converts binary or text data into a 64-character ASCII alphabet so it can travel safely through systems that only handle plain text. A common case: pasting a small PNG into CSS as `background-image: url('data:image/png;base64,iVBORw0K...')` avoids an extra HTTP request. Unlike most online converters, this tool supports URL-safe Base64 (replacing `+` and `/` with `-` and `_`) and handles binary file encoding, not just strings.
Try it now — free, instant, no signup
What is Base64 Encoder / Decoder?
Base64 is a binary-to-text encoding scheme that represents arbitrary byte sequences using only 64 printable ASCII characters (A–Z, a–z, 0–9, plus two symbols). Paste any UTF-8 string — say, `{"user":"alice"}` — and it encodes to `eyJ1c2VyIjoiYWxpY2UifQ==`. Paste a binary file and each group of three bytes becomes four Base64 characters, inflating size by roughly 33%.
Developers tend to reach for this when they need a quick encode-decode round-trip without leaving the browser. RapidTables has a Base64 page but only handles text, not binary files. CyberChef handles binary but requires selecting the right recipe from a long list. If you already have a terminal open, `base64` (macOS/Linux) or `certutil -encode` (Windows) does the same job faster; use this tool when you want to paste a file and share the output without touching the command line.
One gotcha that bites people regularly: the browser's native `btoa()` function throws `InvalidCharacterError` on any character outside Latin-1 (codepoint > 255). This means calling `btoa('café')` crashes. The correct approach is to first encode the string to UTF-8 bytes via `TextEncoder`, then Base64-encode the resulting `Uint8Array`. This tool handles that conversion internally, but if you're writing your own code, that two-step pattern is the reliable path.