Need to turn a snippet into something safe to paste anywhere, or read what a mystery string actually says? This Base64 encoder decoder is a free online tool and converter that does both, and it keeps your input on your device. Paste, click, copy: whether you are an engineer or just curious, this encoder and decoder gives you readable output in seconds.
Using the Base64 Encoder Decoder Online for Text and Files
To base64 decode and encode something, paste your Base64 string or plain Base64 text into the input box and press the button for the direction you need. A browser-based Base64 encoder/decoder lets you encode and decode a short line in one click, or upload a file and download the result when the data is bigger than a paragraph. Everything runs in your browser, so the work is client-side and nothing reaches a server. Switch on live mode and the output updates as you type; to base64 encode a list, put one entry on each line.
- Paste text or choose a file to start the conversion.
- Select the direction: encoding data or decoding it.
- Copy the result, or download it as a file.
Choose a Character Set for UTF-8 Text
Pick the character set that matches your source before converting. UTF-8 suits modern text, while an older document may need Windows-1252. If the output looks scrambled, change this setting first. To keep entries independent, decode each line separately; otherwise newlines count as whitespace inside one payload. Switch the output to hex when you want to inspect the raw bytes of the data.
Base64 Encoding Explained: Binary Data as Printable Text
Base64 encoding is a reversible scheme, a binary to text conversion that turns binary data into printable text. A binary string, such as the bytes of an image, can then travel through any text-based channel, and embedding it in a page causes no damage. That format protects data integrity during transmission. Every three bytes of payload become four characters, so the encoding scheme grows the data by about a third: A passphrase-protected private key plus its fingerprint come out of the free pgp key pair generator without leaving the browser.
$$\text{output length} = 4 \times \left\lceil \frac{n}{3} \right\rceil$$
Why the Alphabet Has 64 Characters
Six bits give exactly 64 values, so the alphabet is A-Z, a-z and 0-9 plus two symbols. Three bytes form a 24-bit block, which splits into four groups of 6 bits, and each group maps to one ASCII character.
Padding and Line Breaks
When the input is not a multiple of three bytes, the encoder adds padding with one or two = signs. RFC 4648 defines those padding characters, yet an unpadded string is common in JWT segments and a decoder should accept it. Wrapped output follows MIME habits, and the IMAP variant swaps one symbol; decoders ignore line breaks.
Decode Base64 Online: A Worked Example
Suppose a log holds the Base64 data SW52b2ljZSAjNDgyMSBwYWlk. A base64 decoder reads four characters at a time, looks up each 6-bit value, joins them into three bytes and prints the matching letters. Going the other way, an encoder starts with the text Invoice #4821 paid, which is 18 bytes, so the formula gives 4 × 6 = 24 characters with no = signs. The table shows the first three blocks. For private notes, the free text encrypter decrypter locks a message with AES-256-GCM, a key derived from your passphrase and a random salt.
| Text block | Bytes in binary | 6-bit values | Base64 |
|---|---|---|---|
| Inv | 01001001 01101110 01110110 | 18, 22, 57, 54 | SW52 |
| oic | 01101111 01101001 01100011 | 27, 54, 37, 35 | b2lj |
| e # | 01100101 00100000 00100011 | 25, 18, 0, 35 | ZSAj |
Run decode base64 on all 24 characters and you get the original sentence back; to encode base64 again, reverse the lookup. If you edit even one character of the encoded text, the decoder returns different bytes from that block onward, which is a quick way to see how tightly each group of four is tied to its three original bytes. Base64 decoding is simply the encoding steps in reverse, so the decoded text matches the text you started with. Decoding a long payload works the same way, only with more blocks, and the same decoding rules apply to every data format you feed in.
Debugging a 401 with the Base64 Decode and Encode Tool
A billing webhook keeps returning 401, and I need to know whether the Basic authentication header is wrong or the receiving server is. The service account is svc_billing and the password is Zoë-8821, so the credential string is svc_billing:Zoë-8821: 20 characters, but 21 bytes in UTF-8 because ë takes two.
I paste that string into the encoder with UTF-8 selected and get c3ZjX2JpbGxpbmc6Wm/Dqy04ODIx. Twenty-one bytes divide evenly by three, so 7 blocks give 28 characters and no =. Then I decode the header copied from the failing request, which reads c3ZjX2JpbGxpbmc6Wm/rLTg4MjE=.
| Source | Bytes | Base64 length | Ends with |
|---|---|---|---|
| UTF-8 (expected) | 21 | 28 | x |
| Header sent (Latin-1) | 20 | 28 | = |
The trailing = is the clue: 20 bytes is not a multiple of three, so the client encoded ë as a single byte, Latin-1 style, while the server expects UTF-8. That one-byte difference explains the 401. Switching the client to UTF-8 produces the expected string, and the next request returns 200.
To cross-check, I redo the final block by hand: 20 bytes leave a final group of just two, the characters 2 and 1 (hex 32 31), which forces one pad sign, whereas 21 bytes end on a full group. The decoder agrees with my arithmetic, so I stop suspecting the receiving server and look at the client instead. What stands out is how little the length tells you: both strings are 28 characters, so a length check would have passed. Check the ending and the character set instead. A caveat: if the password were pure ASCII, both encodings would match and this bug would stay hidden until someone chose an accented password. The fix is to pin UTF-8 in the client, not to strip the accent.
Base64URL: Decode and Encode URL-Safe Strings for JWT Tokens
Base64URL is the URL-safe twin of the standard form: it swaps + and / for - and _ and usually drops the = signs. You will meet it in every JWT, because they travel in links and headers where the standard symbols would break. To base64 decode one, paste the segment as is; the same bytes FB EF BE read ++++ in the standard alphabet and ---- in this one. It keeps the web safe from broken URLs, and every web framework understands the format.
Fixing Unreadable Decoded Text
Troubleshooting garbled output usually means the wrong charset, or that the payload is a file rather than text. Debugging tip: view it as hex first, then choose the right encoding.
Base64 Tool Uses in JSON, Email and APIs
A base64 tool earns its keep wherever binary must ride inside plain text: JSON and XML fields, HTTP headers, and email attachments. Developers lean on it for an API that returns a file inside a response, or when a server expects credentials in a basic authentication header. Remember that the protocol only needs text, not secrecy, and that open source libraries cover encoding and decoding in every language.
Using btoa and atob in JavaScript
Browsers ship btoa() and atob() for converting a base64-encoded string and back, but they only handle Latin-1 characters, so convert to bytes first.
Java and OAuth Tokens
The JDK ships java.util.Base64, and OAuth flows use it for client credentials, so you can paste one into the decoder to see what it holds. Signing keys and certificates also travel as Base64 text, though encryption is a separate step.
Is Base64 Secure? Limitations of an Encoder and Decoder
Base64 offers no security and no secrecy: anyone can reverse it, so never treat it as a lock. It does not check integrity either, unlike a hash, and it is not cryptography or compression, since the output is larger. For privacy, a client-side tool that never uploads your text is the secure choice, and this limitation is why you should encrypt secrets before encoding them.
Frequently Asked Questions
- Does this handle Unicode text correctly (emoji, accented characters, non-Latin scripts)?
- Yes -- text is converted to UTF-8 bytes before Base64 encoding (and decoded back the same way), which correctly round-trips emoji, accented characters, and non-Latin scripts. A naive Base64 implementation built directly on the browser's btoa()/atob() functions breaks on any character outside the Latin-1 range; this tool avoids that by encoding through TextEncoder/TextDecoder first.
- What does 'not valid Base64' mean?
- It means the text you pasted into Decode mode isn't a valid Base64 string -- it contains characters outside the Base64 alphabet (A-Z, a-z, 0-9, +, /, and = for padding), or the length/padding doesn't form complete groups. Double-check you copied the full string with no extra characters.
- Is Base64 encoding the same as encryption?
- No. Base64 is an encoding, not encryption -- it has no secret key and anyone can decode it instantly. It exists to safely represent binary data (or Unicode text) using only printable ASCII characters, for contexts like email attachments, data URIs, JSON payloads, and HTTP headers that can't handle raw bytes. Never use Base64 alone to protect sensitive data.
- Why would decoded text look like garbage?
- That usually means the Base64 string doesn't represent valid UTF-8 text -- for example, if it's actually encoded binary data (an image, a compressed file) rather than text. This tool deliberately fails with a clear error in that case rather than silently showing corrupted text (mojibake).
- Is my text sent anywhere?
- No. Both encoding and decoding happen entirely in your browser -- nothing you type is transmitted, logged, or stored. Reload the page and everything is gone.