How to encode or decode Base64
- Choose Encode to turn text into Base64, or Decode to turn Base64 back into text.
- Type or paste into the left box. The result appears instantly on the right.
- Tick URL-safe if the Base64 will be used in a web address, file name or JSON Web Token.
- To encode an image or any other file, click Encode a file…. You get the Base64 text and a ready-to-use
data:URI.
What is Base64?
Base64 is a way of representing binary data — images, files, encrypted bytes — using only 64 safe text characters: A–Z, a–z, 0–9, + and /, with = used for padding at the end. It lets binary data travel through systems that were designed for text, such as email, JSON, XML, HTML and URLs, without being corrupted.
Every 3 bytes of input become 4 Base64 characters, so encoded data is about 33% larger than the original.
Base64 is not encryption
Base64 only changes how data is written; anyone can decode it instantly. Never use it to hide passwords or secrets. If you need to protect data, use proper encryption.
Where you’ll meet Base64
- Email attachments are Base64-encoded inside the message (MIME).
- Data URIs embed small images directly in HTML or CSS, e.g.
<img src="data:image/png;base64,iVBOR…">, saving an extra request. - JSON Web Tokens (JWT) use URL-safe Base64 for their header and payload.
- HTTP Basic authentication sends
username:passwordencoded in Base64 (always use HTTPS). - APIs often send files and images as Base64 strings inside JSON.
Standard vs. URL-safe Base64
Standard Base64 uses + and /, which have special meanings in URLs. The URL-safe variant (defined in RFC 4648) replaces them with - and _ and usually drops the = padding. When decoding, this tool accepts either form automatically.
Unicode text
Base64 works on bytes, not letters. To encode text such as Bangla, Arabic or emoji correctly, the text must first be converted to bytes using UTF-8. Some simple tools skip this step and produce errors or garbled output; this tool always uses UTF-8 in both directions.
Frequently asked questions
Is Base64 secure?
No. Base64 is an encoding, not encryption. Anyone can decode it, so never use it to protect passwords or private data.
Why does my decoded text look like random symbols?
The Base64 probably contains binary data such as an image or a compressed file, not text. Encoded files cannot be shown as readable text.
Why does Base64 end with = or ==?
The equals signs are padding, added when the input length is not a multiple of 3 bytes. URL-safe Base64 often leaves them out.
Can I convert an image to Base64?
Yes. Click “Encode a file…” and choose the image. You get the Base64 string and a data URI you can paste into HTML or CSS.
Is my data uploaded?
No. All encoding and decoding happens in your browser.