Base64 Encoder & Decoder
Encode text to Base64 or decode it back — fully local and private.
Standard Base64 (UTF-8 text)
About the Base64 Encoder & Decoder
Encode text to Base64, or decode Base64 back into text. Decoding understands every common form (standard, URL-safe with - and _, without = padding, broken into lines, or a full data: URL), and when the Base64 is really a file such as a PNG, PDF or ZIP, it says so and lets you download it.
How to use it
- Choose Encode or Decode.
- Paste the text or the Base64 string. When encoding, tick URL-safe or lines of 76 if you need them.
- Read the status line: decoded text, or the type and size of a file.
- Copy the result, or press Download file for a decoded file.
Tip: Base64 makes data about a third bigger: every 3 bytes become 4 characters. It's for carrying data through text, not for saving space.
What Base64 is (and isn't)
Base64 writes any data, including pictures and files, using only 64 safe characters: A–Z, a–z, 0–9, + and /. That lets binary data travel through systems built for text, such as email, JSON, URLs and HTML.
It is not encryption. Anyone can decode it in a second, so never use Base64 to hide passwords or secrets.
Standard vs URL-safe Base64
When decoding you don't need to choose: both forms, with or without padding, are read automatically.
- Standard
- Uses + and / and pads the end with = so the length is a multiple of 4. Used in email attachments and data: URLs.
- URL-safe (Base64URL)
- Uses - and _ instead, usually without padding, so it can go in a URL or a file name. JWTs use it.
- Lines of 76
- Email (MIME) breaks Base64 into lines of 76 characters; tick the option when you need that format.
Decoding a file instead of text
If the decoded bytes aren't valid text, the tool looks at the first bytes to recognise the file type (PNG, JPEG, GIF, WEBP, PDF, ZIP, GZIP or SVG), shows its size and the first bytes in hex, and offers Download file so you can open it.
This is handy for data: URLs copied from HTML or CSS, attachments in raw emails, and files embedded in JSON API responses.
Text in any language
Text is encoded as UTF-8, the standard for the web, so Urdu, Arabic, Hindi, Chinese and emoji survive the round trip exactly. Some older tools encode only Latin letters and break on anything else.
How Base64 works, step by step
Base64 reads the data three bytes at a time. Those 24 bits are split into four groups of 6 bits, and each group (a number from 0 to 63) is written as one of the 64 characters. The word Man (bytes 77, 97, 110) becomes TWFu.
When the data doesn't divide evenly into groups of three, the last group is padded and = or == is added, so the length is always a multiple of 4. That's why Base64 is about 33% larger than the original.
Data URLs
A data URL puts a whole file inside a link: data:image/png;base64, followed by the Base64. Browsers show it like any other image, which is useful for small icons in HTML, CSS and emails.
Paste a complete data URL into Decode and the tool reads the type from the prefix, recognises the file and offers Download file.
Base64 in emails, APIs and web pages
- Email attachments
- Mail sends files as Base64 inside the message, broken into lines of 76 characters (tick lines of 76 to match).
- APIs
- Images, PDFs and signatures are often sent inside JSON as Base64 text; paste the value here to see or save the file.
- Basic authentication
- An Authorization: Basic header holds user:password in Base64, which is why it must only travel over HTTPS.
- Web pages
- Small icons and fonts are embedded in CSS and HTML as data URLs so the page needs fewer requests.
Tips and tricks
Decode the part after “Basic ” to see the user name and password a request sends (and why it must go over HTTPS).
The data:image/png;base64, prefix is understood; no need to cut it off.
Each part of a JWT is URL-safe Base64; the JWT Decoder reads all three at once.
For turning a picture into Base64 for HTML or CSS, use Image to Base64.
If decoding says the Base64 is cut off, a character was lost when copying; copy it again.
Decoding happens on your device, so tokens and credentials aren't sent anywhere.
Questions
Is Base64 encryption?
No. Anyone can decode Base64; it only turns data into plain letters and digits so it travels safely through text-only systems.
Does it handle emoji and non-English text?
Yes, text is encoded as UTF-8, so Urdu, Arabic, Chinese and emoji survive the round trip.
Can I decode Base64 to an image or PDF?
Yes. When the Base64 is a file, the tool recognises the type and offers Download file.
What is URL-safe Base64?
A variant that uses - and _ instead of + and /, usually without = padding, so it can go in URLs. Decoding reads it automatically; tick URL-safe to encode it.
Why does Base64 end with = or ==?
Padding: it makes the length a multiple of 4 when the data doesn't divide evenly into groups of 3 bytes.
How much bigger does Base64 make my data?
About a third: every 3 bytes become 4 characters, plus a little more if you break it into lines.
Why does decoding say the Base64 is cut off?
Base64 always comes in groups of 4 characters; a length that doesn't fit means a character was lost when copying. Copy it again from the source.
Can I encode a file or an image to Base64?
This tool encodes text. For a picture, use Image to Base64, which gives a ready data URL for HTML and CSS.
Is my data uploaded?
No. The tool runs in your browser; what you paste or open never leaves your device and nothing is stored on a server.
Related tools
Updated