Encode text or files to Base64 and decode them back — entirely in your browser
Inspect, convert in bulk, and build the wrappers that use Base64.
Paste a Base64 string to check whether it is valid, which variant it uses, and what the raw bytes actually are — without decoding it into your clipboard first.
Tip: a string of n bytes always encodes to 4 × ceil(n / 3) characters — 100 bytes becomes 136 characters.
One value per line, converted independently. A malformed line reports its own error rather than breaking the whole batch.
Build or read the Authorization header from RFC 7617.
Inline an asset directly into CSS or HTML — no extra request.
data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIzMiIgaGVpZ2h0PSIzMiI+PGNpcmNsZSBjeD0iMTYiIGN5PSIxNiIgcj0iMTQiIGZpbGw9IiM2MzY2ZjEiLz48L3N2Zz4=
The correct, UTF-8-safe way in each language.
// Text -> Base64 (UTF-8 safe)
const bytes = new TextEncoder().encode(text);
const bin = String.fromCharCode(...bytes);
const b64 = btoa(bin);
// URL-safe variant
const urlSafe = b64.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=+$/, '');// Base64 -> text (UTF-8 safe) const bin = atob(b64); const bytes = Uint8Array.from(bin, c => c.charCodeAt(0)); const text = new TextDecoder().decode(bytes);
Three bytes in, four characters out.
Input M a n ASCII 77 97 110 Bits 01001101 01100001 01101110 Regroup 010011 010110 000101 101110 Index 19 22 5 46 Base64 T W F u
The 64-character alphabet:
| 0–15 | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 16–31 | Q | R | S | T | U | V | W | X | Y | Z | a | b | c | d | e | f |
| 32–47 | g | h | i | j | k | l | m | n | o | p | q | r | s | t | u | v |
| 48–63 | w | x | y | z | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | + | / |
No. Base64 is an encoding, not encryption — it is trivially reversible by anyone, with no key involved. It exists to move binary data through channels that only accept text, such as email bodies, JSON fields, and URLs. Never use it to protect secrets. An HTTP Basic auth header is Base64 precisely because it is not secret; that is why it must only be sent over HTTPS.
Base64 works on 3-byte groups, turning each into 4 characters. When the input length is not a multiple of 3, the final group is padded with = to keep the output a multiple of 4. One leftover byte produces ==, two produce =. The padding carries no data — it only tells strict decoders where the input ended.
The standard alphabet includes + and /, which have special meaning in URLs and file paths — / splits path segments and + can be read as a space in query strings. RFC 4648 §5 defines a variant that uses - and _ instead, usually with the padding stripped since = also needs escaping. This is what JWTs use. The decoder on this page accepts either variant automatically.
About 33% larger: every 3 bytes become 4 characters, so n bytes produce 4 × ceil(n / 3) characters. A 100KB image becomes roughly 133KB of text. If line wrapping is enabled, the newlines add a further ~1.4%. This is why inlining large images as data URIs is usually a false economy — you save a request but send more bytes and lose separate caching.
A valid Base64 string never has a length that leaves a remainder of 1 when divided by 4, because a single leftover character encodes only 6 bits — less than one byte. Getting this error almost always means the string was truncated in transit, or an extra character was picked up when copying. Check the start and end of what you pasted.
The Base64 was probably valid, but the bytes underneath are not text — they are an image, an archive, or another binary format. Text decoding only makes sense when the original data was text. Use the Inspector above to see the detected file type and a hex view, or switch to File mode to download it properly.
No. Every conversion on this page runs in your browser using local JavaScript. There is no API call, no analytics on your input, and nothing is stored. You can confirm it by opening DevTools, switching to the Network tab, and watching while you encode — or by disconnecting from the network, since the page keeps working offline.
Your data stays private. All processing happens locally in your browser. No data is collected, stored, or sent to any server.