Base64 encoder and decoder
Encode or decode Base64 for text, images and files (data URLs), plus URL encode and decode.
File or image โ Base64
Base64 โ file or image
๐ Works offline in your browser. Your files are not uploaded anywhere.
How to use Base64 Encode & Decode
- Pick a tab: Text, File / image or URL encode / decode.
- For text, type or paste it and press Encode, or paste Base64 and press Decode. Unicode such as รฉ, รฑ, ไธญๆ or emoji is handled correctly.
- For files, choose an image or any file to get its Base64 or data URL, or paste Base64 to turn it back into a downloadable file.
- Copy the result, or download it. If decoded Base64 turns out to be an image or a PDF, you get a preview and a download button.
About this tool
Base64 is a way of writing any data, including images, PDFs and text in any language, using only 64 safe characters: A-Z, a-z, 0-9, + and /. It exists because many systems, such as email, JSON APIs, HTML attributes and URLs, can only carry plain text safely. Developers meet it in data URLs (data:image/png;base64,โฆ), email attachments, JSON Web Tokens and API responses that contain files. This tool converts in both directions in your browser, so private files and tokens are never uploaded.
Good to know about Base64
- It is not encryption. Anyone can decode Base64 instantly. Never use it to hide passwords or personal data.
- It makes data about 33% bigger: every 3 bytes become 4 characters. A 30 KB image becomes about 40 KB of text.
- The = at the end is padding that makes the length a multiple of 4. Some systems leave it out; this decoder accepts Base64 with or without it.
- URL-safe Base64 (used in JWTs and many APIs) replaces + with - and / with _ so the text can go in a web address. Tick URL-safe when encoding; decoding accepts both kinds automatically.
- Line breaks: email (MIME) splits Base64 into 76-character lines. Spaces and line breaks are ignored when decoding.
When to put images in Base64
Embedding a small icon or logo as a data URL in HTML or CSS saves a separate download, which helps for images of a few kilobytes. For bigger images it usually hurts: the page gets heavier, the image can't be cached separately and it is decoded on every page view. Use the Copy as menu to get a ready-made <img> tag or CSS background-image line.
URL encoding
URL (percent) encoding is a different thing: it replaces characters that are not allowed in web addresses with % codes, for example a space becomes %20 and รฉ becomes %C3%A9. Encode a single value (a search term or a parameter) normally; tick Encode a whole URL to keep characters like :/?&= that give a full address its structure. Tick Spaces as + for HTML form data.
Frequently asked questions
How do I convert Base64 to an image or PDF?
Open the File / image tab, paste the Base64 or data URL in the second box and press Decode to file. The file type (PNG, JPG, GIF, WebP, SVG, PDF, ZIP, MP3 and more) is detected from its content, and you get a preview and a download.
Why does decoding show strange characters?
The Base64 probably holds a file, not text, or text in an old encoding. This tool detects most file types and offers a download instead of showing garbage.
It says a character is not a Base64 character. What now?
The text was probably copied with something extra, such as quotes, a backslash or part of a JSON key. Remove everything except the Base64 itself (and an optional data: prefix) and try again.
Is there a file size limit?
Files up to 30 MB can be converted. Very long results are shortened on screen to keep your phone responsive, but Copy and Save always use the complete text.
Is my data uploaded?
No. Encoding and decoding happen inside your browser, so it is safe for tokens, API keys and private files.