Skip to main content

How to decode a URL-encoded string

Decoding reverses percent-encoding: each %XX sequence becomes a byte, and the bytes are read as UTF-8 text. Component mode uses decodeURIComponent(), so the result is exactly the original value.

Worked example

Multi-byte UTF-8 sequences become single characters.

Input
caf%C3%A9%20%26%20cr%C3%A8me
Result · decodeURIComponent()
café & crème

%20 becomes a space, but + is kept as a literal plus sign.

Input
a+b%20c
Result · decodeURIComponent()
a+b c

The last sequence is missing a hex digit, so the tool shows an error.

Input
%E0%A4%A
Result · decodeURIComponent()
Invalid encoded URL

With the missing digit restored, the three bytes decode to one Devanagari letter.

Input
%E0%A4%A4
Result · decodeURIComponent()
त

How the tool handles it

  • Each %XX sequence is one byte, and consecutive bytes are decoded together as UTF-8, so %C3%A9 becomes é.
  • A plus sign is not treated as a space: + stays +. If the text came from an HTML form, replace + with %20 before decoding.
  • If any sequence is incomplete or is not valid UTF-8, the whole input is rejected with an error; nothing is partly decoded.
  • Full URL mode (decodeURI) leaves escapes of reserved characters such as %26, %2F and %3F encoded, so the URL structure does not change.

URL encoding guides