Skip to contentHydramill Utilities

Base64 encode and decode online: text, files and URLs

Encode and decode Base64 text (UTF-8 and emoji safe), turn any file into a data URI, and URL-encode or decode strings. Runs in your browser; nothing is uploaded.

100 % in your browser: your files and text never leave your device and nothing is uploaded.

How it works

Choose Text to convert between plain text and Base64: text is first turned into UTF-8 bytes, so accents and emoji work. Tick URL-safe to get a Base64 that uses - and _ and no = padding. When decoding, whitespace, missing padding and a data: prefix are accepted, and an error is shown if the input is not valid Base64 or does not contain UTF-8 text. Choose File to turn any file into a data URI you can paste into HTML or CSS (Base64 makes it about a third larger). Choose URL to percent-encode or decode a string with encodeURIComponent. Everything runs locally.

How to use it

  1. Choose the Type: Text, File to data URI or URL encode.
  2. In Text, pick the Direction (Encode or Decode), paste your content in Input and tick URL-safe Base64 if you want - and _ without = padding.
  3. In File to data URI, choose any file; you receive a data: address you can paste into HTML or CSS. In URL encode, the text is percent-encoded or decoded.
  4. Read the Result and press Copy. When decoding a data URI you can also use Save the decoded data URI as a file.

Worked example

Encode the text Hello and you get SGVsbG8=; with URL-safe ticked the padding is dropped and the result is SGVsbG8. A single accent works because text is converted to UTF-8 first: é becomes w6k=. In the URL tab, a b&c=d/é becomes a%20b%26c%3Dd%2F%C3%A9. A 3 KB PNG becomes a data URI of about 4 KB, since Base64 makes data about one third larger. Pasting an invalid text such as abc$ shows This is not valid Base64.

Frequently asked questions

Is Base64 encryption?

No. It is only a way of writing bytes as text. Anyone can decode it, so never use it to hide passwords.

Is my data uploaded?

No. Text and files are converted in your browser and never sent to a server.

Why do I see an error when decoding?

Either the text is not valid Base64, or it is valid Base64 whose bytes are not UTF-8 text, for example an image. Whitespace, missing padding and a data: prefix are accepted.

When should I use URL-safe Base64?

When the result goes in a URL, a file name or a token, because + and / and = can break there. URL-safe uses - and _ instead and omits the padding.

Why use a data URI?

It embeds a small file directly in HTML or CSS, saving one request. It makes the data a third larger, so use it for icons, not for big images.