Base64 Encode / Decode
Encode and decode Base64 for text, files and data URIs — with URL-safe, padding and line-wrap options.
File to encode
Options
About the Base64 Encoder & Decoder
This free Base64 encoder and decoder converts text, files and data URIs to and from Base64 right in your browser. Switch between Encode and Decode, paste or drop your input, and the result appears instantly — with one-click copy, file download and a live size readout. Text is handled as UTF-8 so emoji and non-English characters survive the round trip, and the decoder is deliberately forgiving: it accepts URL-safe Base64, ignores whitespace, tolerates missing padding and even peels off a data: URI prefix on its own.
Everything runs entirely in your browser — your input is never uploaded to a server, so even sensitive strings and files stay on your device, and the tool works offline once loaded. Beyond plain text you can turn an image or any file into a Base64 data URI to inline it in HTML or CSS, choose the URL-safe alphabet for tokens and filenames, drop the = padding, and wrap long output at 64 (PEM) or 76 (MIME) characters. Remember that Base64 is an encoding for transporting binary data as text, not encryption — anything encoded can be decoded back just as easily.
Frequently asked questions
Answers to the questions we hear most about this tool.
How do I encode text to Base64?
Make sure the mode is set to Encode, then type or paste your text into the input box — the Base64 result appears instantly in the output, ready to copy. Text is read as UTF-8, so emoji and any non-English characters (Cyrillic, Arabic, Chinese, accented letters) are encoded correctly. If you need it for a URL or filename, switch the variant to URL-safe; if you are embedding it in CSS or HTML, tick "Output as a data URI" to get a ready-to-paste data: string.
How do I decode a Base64 string back to text?
Switch the mode to Decode and paste your Base64 into the input — the decoded text shows up immediately. Decoding is forgiving: it ignores spaces and line breaks, automatically accepts URL-safe Base64 (with - and _ instead of + and /), copes with missing "=" padding, and strips a leading data: URI prefix for you. If the string isn't valid Base64 you'll get a clear message instead of garbled output.
What is URL-safe Base64 and when do I need it?
Standard Base64 uses the characters + and / and pads with =, which can break when the value travels inside a URL, query string, cookie or filename. URL-safe Base64 swaps + for - and / for _ (and often drops the = padding) so the value survives unescaped. Use it for things like JWT segments, OAuth tokens and signed URLs. The decoder here accepts both variants automatically, so you never have to convert one to the other by hand.
Can I convert a file or image to a Base64 data URI?
Yes. In Encode mode, click "Encode a file" or drop a file onto the input, and the tool reads its bytes and produces the Base64 — turn on "Output as a data URI" to get a complete data:<mime>;base64,… string you can paste straight into an <img src>, CSS background or inline asset. To go the other way, paste a data URI into Decode mode and use Download to rebuild the original file, with the right type and extension detected automatically.
Is it safe to Base64-encode passwords or sensitive data here?
Your data is private — every conversion runs entirely in your browser with JavaScript, so nothing you type or drop is ever uploaded to a server, and the tool keeps working offline once the page has loaded. That said, remember that Base64 is an encoding, not encryption: anyone can decode it back instantly. It's perfect for safely transporting binary data as text, but it provides no security, so never rely on it to protect secrets.
Related tools
JSON Formatter
Developer
Format, beautify, validate, minify, repair and explore JSON in a tree view — with key sorting, escaping and pinpoint error locations.
Open toolColor Converter
Developer
Convert colors between HEX, RGB, HSL, HSV, CMYK and OKLCH with a live picker, alpha, shades and harmonies.
Open toolColor Palette Generator
Developer
Generate harmonious color palettes and CSS gradients from any base color, then copy HEX, CSS variables or gradient code.
Open tool