HashTools

URL Encoder / Decoder

Percent-encode special characters for safe URL transmission, or decode an encoded string back to plain text.

Mode:
Variant
Output will appear here…

What is percent encoding?

Percent encoding (defined in RFC 3986) is how URLs represent characters that have special meaning in the URL grammar or that fall outside the small set of unreserved ASCII characters. Each byte is replaced by a % followed by two hexadecimal digits — so a space becomes %20, an ampersand becomes %26, and so on.

encodeURI vs encodeURIComponent

encodeURI is for encoding a whole URL — it leaves reserved characters like :, /, ?, &, and # alone so that the URL remains structurally valid. encodeURIComponentis for encoding a single componentof a URL (a query parameter value, a path segment) — it encodes those reserved characters too, so they can't be misinterpreted as URL syntax. As a rule of thumb: use encodeURIComponenton each piece, then assemble the URL by hand.

Common characters that must be encoded

Spaces, non-ASCII characters (Unicode is encoded as its UTF-8 bytes), and the reserved set :/?#[]@!$'()*+,;=all need encoding when they appear inside a value. Forgetting to encode is a frequent source of bugs in URL building, especially when user input flows into query strings.