Base64, URL and HTML

Encode and decode in all three formats

No database: AIMRAN doesn't store your files, text or results

What is Base64, URL and HTML?

This tool converts text between three formats widely used in programming: Base64, URL encoding (the famous %20) and HTML entities such as & or <. It works both ways, for encoding and decoding.

You can also drag in a file, such as an image or a PDF, and get its contents as Base64 or as a data URL to embed in a web page or CSS.

How to use it

  1. Choose the format: Base64, URL or HTML.
  2. Select the action: “Encode” or “Decode”.
  3. Type or paste the text into the input.
  4. Adjust the options, such as the URL-safe variant, “Full URL” or “+ as space”.
  5. Copy or download the result; for files, drag them onto “File to Base64”.

Advantages

Technical details

Base64 follows RFC 4648 on the UTF-8 bytes of the text; the URL-safe variant replaces + and / with - and _ and drops the = padding. When decoding, both variants are accepted, a data:…;base64, prefix is ignored and missing padding is added; if the result isn't valid UTF-8 text, the file type is detected from its signature (PNG, JPEG, GIF, WebP, PDF, ZIP, GZIP, MP3, OGG, MP4, BMP) and offered for download. URL encoding uses encodeURIComponent or, with “Full URL”, encodeURI, which keeps reserved characters; the “+ as space” option interprets application/x-www-form-urlencoded data. For HTML, &, <, >, double and single quotes are escaped, and optionally all non-ASCII characters as numeric references &#x…;. Files up to 25 MB are supported.

Frequently asked questions

What is Base64 and what is it used for?

It's a way of representing binary data with 64 text characters. It's used to embed images in HTML or CSS, send email attachments or put data in JSON and HTTP headers.

Is Base64 encryption?

No. It's just an encoding: anyone can decode it without a key. It doesn't protect information.

What's the difference between encodeURI and encodeURIComponent?

encodeURIComponent also encodes reserved characters such as / ? & =, so it's the right one for parameter values. encodeURI leaves those characters intact and is meant for a full URL.

How do I convert an image to Base64?

Drag the image onto “File to Base64” and copy the result. You can include the data: prefix to use it directly in a src or a CSS url().

What is URL-safe Base64?

A variant that uses - and _ instead of + and / and omits the = padding, so the text can go in URLs and file names. It's the one JWTs use.

More Developers tools