URL Encoder & Decoder

Percent-encode and decode URLs, with a choice between full-URL and single-component encoding, plus a breakdown of the parts of any URL you paste in.

The two encoders, side by side

InputFull URLComponent
https://a.com/b?c=dhttps://a.com/b?c=dhttps%3A%2F%2Fa.com%2Fb%3Fc%3Dd
hello worldhello%20worldhello%20world
a&ba&ba%26b

The middle row is why component encoding is the right default when you are building a query string: ?tag=a&b is read as two parameters, while ?tag=a%26b is read as one parameter whose value contains an ampersand.

Non-ASCII characters

Percent-encoding works on bytes, not characters, and URLs use UTF-8. The letter ə is two bytes in UTF-8, so it encodes to%C9%99 — two escapes for one letter. Characters outside the Basic Multilingual Plane, including most emoji, take four bytes and therefore four escapes.

Frequently asked questions

What is the difference between encodeURI and encodeURIComponent?

encodeURI leaves the characters that give a URL its structure alone — slashes, question marks, ampersands — so it is for encoding a whole URL. encodeURIComponent escapes those too, so it is for encoding a single value going into a query parameter. Using the wrong one is the most common URL bug there is: a value containing an ampersand silently splits into two parameters.

Why does a space sometimes become %20 and sometimes a plus?

Percent-20 is the correct encoding in a URL path. The plus sign comes from HTML form submission, which uses application/x-www-form-urlencoded — an older convention where plus means space. Both appear in query strings in the wild, so decoders generally have to accept either.

Which characters actually need encoding?

Everything except A–Z, a–z, 0–9 and the four marks hyphen, underscore, dot and tilde. Reserved characters such as :/?#[]@!$&'()*+,;= carry structural meaning and must be encoded when they appear inside a value rather than as delimiters. Non-ASCII characters are encoded as their UTF-8 bytes, which is why one accented letter becomes two percent-escapes.

Is double-encoding a problem?

Yes, and it is easy to do accidentally. Encoding an already-encoded string turns %20 into %2520, and the receiving system then decodes once and gets a literal %20 back. If your output looks like it is full of %25, something in the chain has encoded twice.

Related tools