Metrics Adda
Direction
What are you encoding?

A query value, a path segment or a fragment. Slashes, ampersands and question marks inside it are escaped too.

Common questions

  • What is URL encoding?

    Also called percent-encoding. A URL may only carry a limited set of ASCII characters, so everything else is written as a percent sign followed by the hex of each UTF-8 byte it takes. A space becomes %20 and é becomes %C3%A9.

  • Should I encode the whole URL or just one value?

    One value, nearly always. Encoding a value escapes the slashes, ampersands and question marks inside it, which is what stops an & in someone's search term starting a new parameter. Encoding a whole URL leaves those alone so the link still works — right when the URL itself contains a space, wrong for anything going inside a query string.

  • Why is a space sometimes + and sometimes %20?

    Because HTML forms use a different convention from the rest of a URL. In application/x-www-form-urlencoded, which is what a submitted form produces, a space is written + and a literal plus is %2B. Anywhere else in a URL a + is simply a plus. The checkbox switches between the two.

  • Why do ! ' ( ) and * come back unescaped?

    Because the browser's own encodeURIComponent, which this page uses, predates RFC 3986 and leaves those five alone. They are safe in practice inside a query string. A few protocols — OAuth 1.0 signatures in particular — require them escaped, and those need a stricter encoder than any browser ships.

Other tools

See all 5 text tools