Base64 Encoder and Decoder: Encode or Decode Base64 Online

Convert text to Base64 or decode Base64 back into readable text, with complete Unicode support and a URL-safe mode. You can also turn any file or image into a Base64 data URI.

  • UTF-8 safe
  • URL-safe Base64
  • Runs locally

How to use the Base64 Encoder / Decoder tool

  1. Select a modePick “Text” to encode or decode strings, or “File to Base64” to make a data URI from a file.
  2. Provide the inputType or paste text, or drag a file onto the box.
  3. Encode or decodePress the relevant button, and tick “URL-safe” if the output will go into a URL or file name.
  4. Copy the outputCopy the result, or swap it into the input to reverse the conversion.

Base64 tool features

  • Unicode handledEmoji, accented characters and non-Latin scripts convert correctly in both directions.
  • Base64URL modeSwaps + and / for - and _ and drops the padding, as JWTs and many APIs expect.
  • File to data URIEmbed small images, icons and fonts directly in HTML, CSS or JSON.
  • Clear error messagesInvalid characters and binary content are detected and explained.
  • PrivateTokens and secrets stay inside your browser.

What is Base64 encoding?

Base64 represents binary data using just 64 printable characters, A–Z, a–z, 0–9, + and /, with = as padding. It exists so that any data, images and other binary files included, can pass safely through systems built for text, like email, JSON, XML and URLs.

Remember that Base64 is encoding, not encryption. Anyone can reverse it, so it should never be relied on to protect passwords or secrets.

How Base64 encoding works

The encoder reads the input three bytes (24 bits) at a time and divides them into four 6-bit chunks. Each chunk, a value from 0 to 63, maps to one of the 64 characters. Since every 3 bytes become 4 characters, encoded output is roughly 33% bigger than the source. When the input length isn’t divisible by three, one or two = signs pad the end.

For example, the text Cat is the bytes 67, 97, 116, which encode to Q2F0.

Where Base64 is used

  • Data URIs: small images or fonts embedded straight into HTML or CSS, as in data:image/png;base64,iVBOR…, saving a network request.
  • APIs and JSON: carrying file contents or binary data inside JSON payloads.
  • Email: MIME encodes attachments with Base64.
  • HTTP Basic Auth: sends username:password Base64-encoded, which is why it must only travel over HTTPS.
  • JSON Web Tokens: the header and payload are Base64URL-encoded; inspect them with our JWT Decoder.

Standard Base64 vs URL-safe Base64

In URLs and file paths, + and / carry special meanings, and = appears in query strings. The URL-safe variant, Base64URL, replaces + with - and / with _, and typically leaves out the padding. The decoder here recognises both forms automatically.

When to avoid Base64 data URIs

Inlining images is convenient for tiny icons, but bigger pictures bloat your HTML and CSS, stop the browser caching the image separately and can slow page rendering. A good rule is to inline only images of a few kilobytes or less. For pictures specifically, the Image to Base64 tool adds ready-made HTML and CSS snippets.

Frequently asked questions

Is Base64 a form of encryption?
No. It’s a reversible encoding that anyone can decode, so never use it to hide passwords or sensitive data.
Why is Base64 longer than the original?
Each 3 bytes of input become 4 output characters, making Base64 roughly 33% larger.
Does it work with emoji and non-English text?
Yes. Text is turned into UTF-8 before encoding, so any language and emoji are handled correctly.
What is URL-safe Base64?
A variant using - and _ instead of + and / and omitting the = padding, so the output can sit safely in URLs and file names. JWTs and many web APIs use it.
Is my data sent anywhere?
No. Encoding and decoding happen entirely in your browser.