URL Encode and Decode Online

Percent-encode text for a URL, or decode %20 and %C3%A9 back to readable characters. Both panes are editable and update each other as you type.

0Characters in
0UTF-8 bytes
—Size change

What is URL Encode and Decode?

URL encoding, also called percent-encoding, replaces characters that are unsafe or reserved in a URL with a % followed by the two hex digits of each UTF-8 byte. A space becomes %20, an ampersand becomes %26, and é becomes %C3%A9 because it is two bytes in UTF-8. The rules come from RFC 3986, which splits characters into unreserved (letters, digits, and - _ . ~), reserved delimiters that carry meaning in the URL grammar, and everything else. JavaScript exposes two encoders: encodeURIComponent escapes the reserved delimiters as well, which is what you want for a single query-string value, and encodeURI preserves them so a complete URL stays valid.

How to use

  1. Pick a mode: encodeURIComponent for a single query value, encodeURI for a whole URL.
  2. Type in the left pane to encode, or paste percent-encoded text in the right pane to decode.
  3. Copy either side, or hit Swap to move the encoded result back to the input.

Frequently asked questions

What is the difference between encodeURI and encodeURIComponent?

encodeURIComponent escapes the reserved characters : / ? # [ ] @ $ & + , ; = as well as spaces, so it is the right choice for one query-string value or one path segment. encodeURI leaves those reserved characters alone because they are part of the URL syntax, so it is the right choice when you are encoding an entire URL and want it to stay clickable.

Why do I get URIError: URI malformed when decoding?

decodeURIComponent throws when a percent sign is not followed by two hex digits, or when a multi-byte UTF-8 sequence is cut short. Decoding %E0%A4%A fails because the three-byte sequence is missing its last byte. This tool catches the error and tells you where the encoding is broken instead of returning nothing.

How are spaces encoded in a URL?

Both encodeURI and encodeURIComponent turn a space into %20. The plus sign is only a space inside application/x-www-form-urlencoded form bodies and query strings written by HTML forms, so + and %20 are not interchangeable in a path.

Does this handle emoji and accented characters?

Yes. Text is encoded as UTF-8 first, so é becomes %C3%A9 and a rocket emoji becomes %F0%9F%9A%80. Decoding reverses it. Nothing is sent to a server, so tokens and signed URLs stay on your machine.

Last updated

Powered by maratool