URL encode & decode

Percent-encode text so it is safe inside a URL, or decode %XX sequences back to readable text.

How percent-encoding works

Characters outside the unreserved set A–Z a–z 0–9 - _ . ~ are converted to their UTF-8 bytes and each byte is written as % followed by two hex digits. A space becomes %20; "ë" (2 UTF-8 bytes) becomes %C3%AB.

Component vs full URL

encodeURIComponent also encodes / ? : @ & = + $ , #, so use it for a single query value or path segment. encodeURI leaves those reserved characters alone so a complete URL stays usable.

CharacterencodeURIComponentencodeURI
space%20%20
/%2F/
?%3F?
&%26&
=%3D=
#%23#
é%C3%A9%C3%A9

Why + sometimes means space

HTML forms submitted as application/x-www-form-urlencoded encode spaces as +. In a path, a + is a literal plus sign. Tick or untick "Decode + as space" to match your source.

Frequently asked questions

What does %20 mean?
It is a percent-encoded space: 0x20 is the ASCII code for space.
Why do I get "URI malformed"?
A % is followed by something that is not two hex digits, or the bytes do not form valid UTF-8. Encode stray % signs as %25.