How to use the base64 encoder and decoder
- Choose Text, File to Base64, or Base64 to file.
- For text, pick Encode or Decode and type or paste. Turn on URL-safe to use - and _ instead of + and /.
- For files, choose a file up to 10 MB and copy the Base64 string or data: URI.
- To rebuild a file, paste Base64 or a data: URI. The type is detected and you can download the file.
Worked example
Non-ASCII text
Grüße encodes to R3LDvMOfZQ==, because ü and ß each take two bytes in UTF-8. Hello, world! encodes to SGVsbG8sIHdvcmxkIQ==. Decoding abc$ fails with an invalid character error at position 4.
How it works
Text is converted to UTF-8 bytes with TextEncoder, then to Base64 (RFC 4648). URL-safe output replaces + and / with - and _ and can omit padding. Decoding accepts both alphabets, ignores whitespace and a data: prefix, validates characters, padding and length, then decodes the bytes with a strict UTF-8 decoder so binary data is reported rather than shown as garbled text.
Frequently asked questions
Is my data uploaded?
No. This tool runs entirely in your browser. Your input is processed on your device and is not sent to our server or stored.
Is Base64 encryption?
No. Base64 is an encoding that anyone can reverse. Do not use it to hide passwords or secrets.
Why does decoding say the result is not valid UTF-8?
The Base64 contains binary data such as an image or a zip file, not text. Use the "Base64 to file" option to download it instead.
What is URL-safe Base64?
A variant (base64url) that uses - and _ instead of + and /, so the result can go in URLs and file names without escaping. JSON Web Tokens use it without padding.
Limitations
- Files are limited to 10 MB because the Base64 text is about 33% larger than the file and is held in memory.
- Very long outputs are available through Copy and Download rather than shown on screen.