Base64 Encoder & Decoder
Encode text or files to Base64 or a data: URI, and decode it back — text, or the file inside with its type and a preview.
Base64 Encoder & Decoder
Text
Base64
The Base64 appears here as you type.
Runs in your browser — nothing you enter leaves this device.
About this tool
What it does
Base64 turns any text into a string made of 64 safe characters, so it can travel through systems that only accept plain ASCII — email bodies, URLs, JSON fields and HTTP headers. This tool encodes text or any file to Base64 — plain, URL-safe, wrapped for MIME, or as a data: URI — and decodes Base64 back to text in any language. When the value holds a file rather than text, it recognises the type from its first bytes (PNG, JPEG, PDF, ZIP and more), previews images and lets you download the file.
How to use it
- Choose Encode or Decode.
- To encode, choose Text and type, or choose File and pick any file up to 10 MB. To decode, paste Base64 or a whole data: URI.
- Turn on URL-safe to use - and _ instead of + and /, and drop the = padding. Turn on MIME wrapping for email attachments, or “As a data: URI” to paste a file straight into CSS or HTML.
- If a decoded value is a file, check its type and hex bytes, look at the preview if it is an image, and download it.
- Press the swap button to move the result back into the input and reverse the direction.
- Copy the result.
Limits and your data
- Base64 is an encoding, not encryption. Anyone can decode it; never use it to hide a secret.
- File types are recognised by their signature bytes. A type it doesn’t know is shown as binary data with its hex bytes, and downloads as .bin.
- DOCX, XLSX, JAR and APK files are ZIP archives underneath, so they are recognised as ZIP.
- Text and files are limited to 10 MB.
- Encoding and decoding happen in your browser. Nothing you paste is uploaded or stored. Base64 is often used to carry credentials in headers — treat decoded output with the same care as the original.
Questions
Why is the encoded text longer than the original?
Base64 uses four characters for every three bytes, so output is about a third larger. Text in Hindi or emoji grows more, because each character takes several UTF-8 bytes before encoding.
What is URL-safe Base64?
Standard Base64 uses + and /, which have special meanings in URLs. The URL-safe variant swaps them for - and _ and usually leaves off the trailing = padding. JWTs use it.
How do I turn Base64 back into an image or PDF?
Paste it in Decode. If it is a file, the tool names the type, shows a preview for images, and gives you a Download button. It works with a data: URI too, such as one copied from CSS or an <img> tag.
Is Base64 secure?
No. It hides nothing — it is only a way to represent bytes as text. Use encryption if the content needs protecting.