This tool runs in your browser using JavaScript. If it does not appear, please enable JavaScript or reload the page. The description below explains how it works.
Base64
Base64 is a way to represent binary data (bytes) as a safe, printable string made of letters, digits, and a few symbols. It is everywhere on the web - it powers data URIs in img tags, JWT tokens (eyJ…), and the bodies of many APIs. This tool converts text into Base64 and back.
How to use
- Type or paste your text (or a Base64 string) into the left panel - the result updates as you type.
- Encode / Decode - pick the direction with the segmented buttons:
- Encode turns text into Base64. The text is encoded as UTF-8 bytes first, so accents, emojis, and non-Latin scripts all work.
- Decode turns Base64 back into text. Text must be valid UTF-8; if the decoded bytes aren't, a clear error is shown instead of mojibake.
- Swap - moves the current result into the input and flips the direction, so you can chain encode → decode → encode.
- Copy - puts the current result on your clipboard.
Options
- URL-safe - uses
-and_instead of+and/, the variant that can appear safely in URLs and filenames (JWT uses this). Padding=is kept, so the two forms stay interchangeable. - Ignore line breaks - removes whitespace and newlines from the input before decoding. Many Base64 outputs wrap at 76 characters, and pasting them back in needs this.
Notes and examples
Helloencodes toSGVsbG8=. Try it, then hit Decode to getHelloback.- A valid Base64 length is a multiple of 4, with
=padding (0, 1, or 2 characters) filling the final group. The tool also accepts unpadded input likeSGVsbG8. - Invalid characters and misplaced padding produce an error that names the offending character, so you know exactly where the string is off.
- Base64 encodes bytes, not necessarily text. Decoding arbitrary bytes only succeeds when they happen to be valid UTF-8 - anything else is exactly what the error on non-UTF-8 behaviour is for.
- For reference: the empty string encodes to nothing (empty output), and each group of 3 input bytes becomes 4 Base64 characters.