Base64 Encode and Decode
Convert text or files to Base64 and back. UTF-8 safe, with a URL-safe option.
Runs in your browser · nothing is uploaded
How to use the Base64 Encode / Decode
- Choose Encode or Decode.
- To encode, type or paste text, or open a file to get its Base64 or a ready-to-use data URL.
- To decode, paste Base64. Standard and URL-safe Base64 both work, with or without = padding and line breaks.
- Copy the result, or download it if the decoded data is a file rather than text.
About this tool
Base64 turns any bytes into 64 safe characters (A–Z, a–z, 0–9, + and /), so binary data can travel through systems built for text: JSON payloads, email attachments, data URLs in HTML and CSS, HTTP Basic auth headers and JWTs. The cost is size: Base64 output is about a third larger than the input.
Text is converted to UTF-8 bytes before encoding, so Hindi, emoji and every other script round-trip correctly. That fixes the classic btoa() error in JavaScript, which only accepts Latin-1 characters. The URL-safe variant (Base64URL) replaces + and / with - and _ and drops the padding, which is what JWTs and many URLs use.
Base64 is an encoding, not encryption: anyone can decode it. Never use it to hide passwords or keys.
Frequently asked questions
›Why is my decoded text garbled?
The original data may not be text, for example an image or a zip file. In that case the tool tells you it is binary and offers a download instead. It could also be text in an older encoding than UTF-8.
›What is URL-safe Base64?
A variant that uses - and _ instead of + and /, and usually no = padding, so it can sit in URLs and file names without escaping. JWTs use it.
›Is Base64 encryption?
No. It is a reversible encoding with no key, so it hides nothing. Use real encryption for secrets.
›Is my data sent anywhere?
No. The tool runs entirely in your browser with JavaScript. What you paste is never uploaded, logged or stored on our servers, so it is safe to use with internal data, though you should still treat secrets with care on shared computers.
›How do I use an image as Base64 in HTML?
Open the image under Encode and copy the data URL. It starts with data:image/png;base64, and can go straight into an img src or a CSS url().