How to use it
- Choose Text or File at the top.
- For text, pick a direction and type or paste. The result updates as you type.
- To encode a file, choose or drop it (up to 10 MB). Tick “Output as data URL” if you want to embed it in HTML or CSS.
- To turn Base64 back into a file, choose Base64 → Text, paste the data and click “Download as file”.
How it works
Base64 represents binary data using 64 printable ASCII characters: A–Z, a–z, 0–9, + and /. Every 3 bytes become 4 characters, so the encoded form is about 33% larger than the original. When the input length is not a multiple of 3, the output is padded with one or two = signs.
Base64 is an encoding, not encryption. Anyone can decode it without a key, so it must never be used to hide passwords or personal data. It exists so that binary data can travel through systems built for text, such as email (MIME), JSON, XML, HTTP headers and data URLs.
Text is first converted to UTF-8 bytes, so characters outside ASCII are encoded correctly. This matters because the browser's built-in btoa function fails on characters such as é or emoji. When decoding, the tool checks that the result is valid UTF-8; if it is not, the data is binary and is shown as hexadecimal instead of as garbled text.
The URL-safe variant (base64url, RFC 4648 section 5) replaces + with - and / with _, and usually omits the = padding, because those characters have special meanings in URLs. It is used in JSON Web Tokens and many web APIs. MIME line wrapping (RFC 2045) breaks the output into lines of at most 76 characters, which some email systems and PEM certificate files require.
Decoding is tolerant where it is safe to be: whitespace and line breaks are skipped, missing padding is added, and both alphabets are accepted. Anything else, such as a stray character or padding in the middle, is reported with its position instead of being silently ignored.
Examples
Encoding text with accents and emoji
“Grüße 👋” becomes R3LDvMOfZSDwn5GL. The ü and ß each take 2 UTF-8 bytes and the emoji takes 4, so 7 characters turn into 12 bytes and 16 Base64 characters.
Building an HTTP Basic Authorization header
For user “alice” and password “s3cret”, encode alice:s3cret to get YWxpY2U6czNjcmV0 and send the header Authorization: Basic YWxpY2U6czNjcmV0. Because Base64 is not encryption, Basic authentication must only be used over HTTPS.
Recovering a file from a data URL
Paste a string such as data:image/png;base64,iVBORw0KGgo… into Base64 → Text. The tool removes the prefix, recognises the PNG data, shows a hex view because it is not text, and “Download as file” saves decoded.png.
Frequently asked questions
Is Base64 a form of encryption?
No. Base64 is a reversible encoding with no key or secret. Anyone who sees a Base64 string can decode it instantly, so never rely on it to protect passwords, tokens or personal information.
Why does my decoded text show strange characters in other tools?
Usually because the text was encoded as UTF-8 but decoded as Latin-1 (or the other way round). This tool always uses UTF-8 and tells you when the decoded bytes are not valid UTF-8 text.
What is the difference between Base64 and base64url?
They use the same method, but base64url replaces + with - and / with _ and normally drops the = padding, so the result can be used in URLs and file names without further escaping. This decoder accepts both forms.
Why is the Base64 output bigger than the file?
Base64 turns every 3 bytes into 4 characters, which adds about 33%. Line wrapping adds 2 more characters (CRLF) per 76. For large images it is usually better to serve the file normally than to embed it as a data URL.
Is there a size limit?
Files can be up to 10 MB. Pasted text has no fixed limit, but very large inputs (tens of megabytes) can make the page slow, especially on phones.
Privacy
Encoding and decoding happen in your browser. Text and files are never uploaded or stored, and their contents are not included in analytics. Downloads are created locally on your device.