Base64 encode and decode
Encode text to Base64 or decode Base64 back to readable text. The tool handles UTF-8 properly, so Hindi, emoji and accented letters round-trip correctly. You can also switch to URL-safe Base64, or turn a file or image into a Base64 data URI for embedding in HTML, CSS or JSON.
File to Base64
How to use the base64 encode and decode
- Choose Encode text to Base64 or Decode Base64 to text.
- Type or paste into the input box. The result updates as you type.
- Tick URL-safe Base64 if the result will go in a web address or a JWT.
- To encode a file, use File to Base64 and choose a file up to 5 MB.
- Copy the result, or press Swap input and result to reverse it.
How it works
Base64 turns any data into text made of 64 safe characters: A–Z, a–z, 0–9, + and /, with = used as padding at the end. Every 3 bytes of data become 4 Base64 characters, so encoded data is about 33% larger than the original.
Text is first converted to bytes using UTF-8, the standard used on the web, then encoded. Decoding reverses the steps.
URL-safe Base64 (also called base64url) replaces + with - and / with _, and drops the = padding, so the result can sit in a web address or file name. JSON Web Tokens (JWTs) use it.
Data URIs look like data:image/png;base64,iVBOR…. Browsers can load them directly, which is handy for small icons, but large files make pages heavy.
Base64 is not encryption. Anyone can decode it. Never use it to hide passwords or private data.
Example
Hello encodes to SGVsbG8=.
नमस्ते (6 Unicode characters, 18 bytes in UTF-8) encodes to 4KSo4KSu4KS44KWN4KSk4KWH.
Frequently asked questions
What is Base64 used for?
Sending binary data through systems built for text: email attachments (MIME), embedding images in HTML or CSS, storing files in JSON, and Basic authentication headers.
Is Base64 secure?
No. It's an encoding, not encryption. Anyone can decode it in seconds, so don't use it to protect secrets.
Why does decoding show an error about binary data?
The Base64 represents something that isn't text, such as an image or a PDF. Text decoding can't show it.
Why is my Base64 longer than the original?
Base64 uses 4 characters for every 3 bytes, so the output is about a third larger.
Are my files uploaded?
No. Encoding and decoding happen in your browser.
Last updated: 25 October 2026