Skip to content

Encode / decode

Encode and decode Base64, URL-safe Base64, URL components and HTML entities, correctly for any text.

Input

sample · 1 line · 35 chars

Output

1 line · 52 chars

What it does

Converts text to and from four encodings that come up constantly in web work:

  • Base64, for putting data where only plain text is allowed.
  • Base64 URL-safe, the variant used in tokens and URLs.
  • URL, the %20 style used for a value inside a web address.
  • HTML entities, such as < and &, for showing text that contains markup characters.

Everything is treated as UTF-8, so accented letters, non-Latin scripts and emoji come through intact in both directions.

How to use it

  1. Pick the format, then Encode or Decode.
  2. Paste or type into the input pane. The result updates as you type.
  3. Press Copy, or Download to save the result as a text file.

Use output as input moves the result back to the input and turns the direction round. Use it to check that a value survives a round trip, or to undo two layers of encoding one after the other.

When the input cannot be decoded, the output pane says why: a character that does not belong, a % that is not followed by two hex digits, or Base64 that has been cut short.

Questions

Is Base64 a form of encryption?

No. Base64 only rewrites data using 64 safe characters so it can travel through places that expect plain text. Anyone can decode it, as this page does. Do not use it to hide a password or a key.

What is the difference between Base64 and URL-safe Base64?

Standard Base64 uses + and /, which have their own meaning in a URL, and pads the end with =. The URL-safe form uses - and _ instead and leaves the padding off. It is what JSON Web Tokens and many API keys use. If decoding fails with one, the message tells you to try the other.

Why does decoding say the result is binary data?

The input is valid Base64, but the bytes it stands for are not text: an image, a compressed file or an encryption key, for example. This tool shows text, so it tells you that instead of printing garbage.

Why is a + not turned into a space when I decode a URL?

In a URL, a space is written %20. The + for a space belongs to form submissions, a slightly different encoding, so this tool leaves + as it is. If your text came from a form, replace each + with %20 before decoding.

Which characters does HTML encoding change?

Five: & becomes &amp;, < becomes &lt;, > becomes &gt;, the double quote becomes &quot; and the apostrophe becomes &#39;. Those are the ones that can be mistaken for markup. Accented letters and emoji are left alone, because a UTF-8 page shows them as they are.

Is what I paste sent anywhere?

No. Encoding and decoding happen in your browser. Tokens, keys and URLs you paste here do not leave your device.