All tools run in your browser — your files never leave your device.

Base64 encode and decode online

Convert text to Base64 and back, or turn an image into a data URI you can paste straight into CSS or HTML.

Runs entirely in your browser. Nothing you paste or upload is transmitted.

Mode


      

How to use the Base64 encoder and decoder

  1. Stay on the Text tab for strings. Paste plain text and press Encode, or paste a Base64 string and press Decode — the tool does not guess which you meant, so you stay in control.
  2. Tick the URL-safe box when the result is going into a URL or a filename. It swaps the two characters that cause trouble there, + and /, for - and _.
  3. Switch to the image tab to turn a file into a data URI. Drop in an icon or logo and you get the full data:image string plus a ready-made CSS background rule.
  4. Copy the result. For images, the CSS button gives you the complete background-image declaration rather than just the raw string.

What you can use it for

Embedding a small icon directly in CSS or HTML removes an HTTP request. For a 2 KB logo that appears on every page, inlining it as a data URI can measurably improve first paint, because the browser does not have to open a connection and wait for a round trip to get it.

Decoding tokens is a debugging staple. A JSON Web Token is three Base64url-encoded segments separated by dots — paste the middle one with URL-safe mode on and you can read the claims directly, which is far faster than adding logging to find out why an authorisation is failing.

Email systems and older APIs still use Base64 heavily. Attachments in raw MIME messages, HTTP Basic Authorization headers, and several payment gateway callbacks all arrive encoded, and being able to decode one quickly turns an opaque blob into something you can read.

Configuration files sometimes carry Base64-encoded certificates or keys. Decoding to check you have the right one before deploying is a good habit, and doing it in a tool that never transmits the value is the only responsible way to do it.

Things to know about Base64

Base64 is an encoding, not encryption. Anyone can decode it instantly, as you are doing here. It exists to move binary data safely through systems that only handle text, and it provides no security whatsoever. Never treat a Base64 string as a way to hide anything.

Encoding makes data roughly 33% larger, because every three bytes become four characters. That is the trade you accept for inlining an image. It stops being worthwhile somewhere around 5 to 10 KB — above that, the extra bytes on every page load outweigh the saved request, and a normal cached image file wins.

The = signs at the end are padding, added so the length is a multiple of four. There will be none, one, or two. URL-safe Base64 often drops them entirely, which is valid but means some strict decoders reject the string until you add them back.

Unicode needs care. Base64 works on bytes, not characters, so text is UTF-8 encoded first and then Base64 encoded. This tool handles that for you, which is why emoji and Devanagari round-trip correctly here when a naive browser btoa() call would throw an error on them.

Frequently asked questions

No, and this is the single most important thing to understand about it. It is a reversible text representation of binary data with no key and no secret. Anything you Base64 encode can be read by anyone who receives it. If you need actual secrecy, you need encryption.

Usually the input was not Base64 to begin with, or it was truncated when copied. It can also mean the data was binary — a decoded image or ZIP file is meaningless as text. Check that the string contains only A-Z, a-z, 0-9, +, / and trailing = signs, and that you copied all of it.

For small, critical, rarely-changing assets: a logo, a UI icon, a background pattern under 5 KB. Do not do it for photographs or anything large. Inlined images cannot be cached separately, so a big one is re-downloaded with every page instead of once.

A variant that replaces + with - and / with _, because those two characters have special meanings in URLs and would otherwise need percent-encoding. It is what JSON Web Tokens use. If a token fails to decode normally, switching the URL-safe option on usually fixes it.

No hard limit, but data URIs above a few hundred kilobytes become unwieldy and some older tools truncate very long strings. If your encoded output runs to hundreds of thousands of characters, the file is too big to be inlined and should stay a normal image request.