Base64 Encode & Decode
Encode text or a file to Base64, or decode Base64 back to readable text. It handles Unicode and URL-safe Base64, and works entirely in your browser.
How to encode or decode Base64
- Pick Encode to turn text into Base64, or Decode to turn Base64 back into text.
- Type or paste into the input box. The result updates as you type.
- Turn on URL-safe if the result goes into a URL or filename (it uses - and _ instead of + and /).
- To convert an image or other file, use File to Base64 below and copy the data URI.
What Base64 is and when to use it
Base64 represents any data using only 64 safe text characters (A–Z, a–z, 0–9, + and /), so binary data can travel through systems built for plain text: email attachments, JSON, HTML, CSS and URLs. Every 3 bytes become 4 characters, so the encoded text is about one third larger than the original.
Common uses are embedding a small image directly in HTML or CSS as a data: URI, sending a file inside a JSON API request, and reading the payload of a token such as a JWT (which uses URL-safe Base64).
Base64 is not encryption
Anyone can decode Base64 instantly; it provides no secrecy. Do not use it to hide passwords, keys or personal data. If you need to protect information, encrypt it with a proper tool, and treat a Base64 string of a secret as the secret itself.
Unicode, URL-safe Base64 and common errors
- Unicode: text such as Hindi, Arabic, Malayalam or emoji is converted to UTF-8 bytes first, so it round-trips correctly. Plain
btoa()in a browser fails on those characters. - URL-safe: replaces + with - and / with _ and drops the = padding, so the value is safe in URLs and filenames. The decoder accepts both forms.
- “Not valid Base64”: the input contains characters other than A–Z, a–z, 0–9, +, /, = (or - and _). Remove spaces from copy-paste mistakes or stray quotes.
- “Not UTF-8 text”: the data decodes but is binary, such as an image. Decode files with a tool built for that type.
Frequently asked questions
How do I encode text to Base64?
Choose Encode, then type or paste your text. The Base64 result appears immediately and you can copy it. Unicode text is handled as UTF-8.
How do I convert an image to Base64?
Use File to Base64 below the main box: choose the image and copy the data URI (it starts with data:image/…;base64,). You can paste that straight into an HTML img src or a CSS url().
Is Base64 secure?
No. Base64 is an encoding, not encryption, and anyone can decode it. Never rely on it to protect secrets.
What is URL-safe Base64?
A variant that uses - and _ instead of + and / and usually omits padding, so the string can be used in URLs, filenames and JWTs without escaping.
Are my text and files uploaded?
No. Encoding and decoding run in your browser, and files are read on your device only.