Skip to content
All tools›Encoders / Cryptography›Url Encoder & Decoder

Url Encoder & Decoder

Encodes or decodes a string so that it conforms to the URL specification (RFC 3986 / RFC 1738). All reserved characters are handled.

Loading tool...

URL Encoding Explained

Why do URLs need to be encoded?

A URL can only be transmitted using the US-ASCII character set, and many characters have special meaning. RFC 3986 defines percent-encoding: each byte that is not allowed is replaced by % + two hexadecimal digits.

Reserved and unreserved characters

Class Characters Treatment
Unreserved A-Z a-z 0-9 - _ . ~ Never need to be encoded
Reserved : / ? # [ ] @ ! $ & ' ( ) * + , ; = Have meaning in some components
Everything else space, <, >, non-ASCII... Always percent-encoded

encodeURI vs encodeURIComponent

Mode Leaves unencoded Use for
encodeURIComponent() A-Z a-z 0-9 - _ . ! ~ * ' ( ) Single values inside URLs (90% of cases)
encodeURI() Above plus ; / ? : @ & = + $ , # Complete URLs with structure
Form encoding A-Z a-z 0-9 - _ . *, space→+ HTML form submissions
---