URLs can only contain a limited set of ASCII characters, so spaces, Cyrillic and symbols like & are written as %XX bytes of their UTF-8 form. The encoder supports both JavaScript functions: encodeURIComponent for a single value and encodeURI for a whole address. Decoding points to the exact position of a broken sequence such as %D0 without its second byte.
The parser below splits a full URL into protocol, host, port, path and fragment, and lists query parameters already decoded. For internationalized domains it shows both the punycode host that goes over the network and the readable Unicode one.
How to use
- Choose Encode or Decode and paste the text.
- Pick encodeURIComponent for a query value or encodeURI for a full URL.
- Turn on "+" as space if the data comes from an HTML form or goes into one.
- To inspect a link, paste it into the URL parser and copy the parts you need.
Examples
привет мир → %D0%BF%D1%80%D0%B8%D0%B2%D0%B5%D1%82%20%D0%BC%D0%B8%D1%80
a/b?c=d → a/b?c=d (encodeURI) a/b?c=d → a%2Fb%3Fc%3Dd (encodeURIComponent)
пример.рф → xn--e1afmkfd.xn--p1ai
Frequently asked questions
What is the difference between encodeURI and encodeURIComponent?
encodeURI assumes the input is a complete URL and leaves : / ? # & = alone. encodeURIComponent encodes them too, so a value like a&b=c cannot break the query string. For parameter values you almost always want encodeURIComponent.
Should a space be %20 or +?
Both are seen. + means a space only in application/x-www-form-urlencoded data, which is what HTML forms send and what URLSearchParams produces. In the path part of a URL a plus is a literal plus, so use %20 there.
Why does decoding fail with "URI malformed"?
Either a % is not followed by two hex digits (for example a literal 100%), or the bytes do not form valid UTF-8, often because the string was cut in the middle of a multi-byte character or was encoded in Windows-1251.
What is punycode?
DNS only works with ASCII, so a domain like пример.рф is stored as xn--e1afmkfd.xn--p1ai. Browsers show the Unicode form and send the punycode one.