URL Encoder / Decoder

Encode and decode URL strings using standard percent-encoding rules (encodeURI & encodeURIComponent).

Scope:
Plain text / URL
Encoded output
Output will appear here...
Component mode — encodes all special chars including : / ? # @. Use for individual query parameter values.

Component vs Full URL Encoding Rules

JavaScript FunctionPreserved CharactersEncoded CharactersRecommended Use Case
encodeURIComponentA–Z a–z 0–9 - _ . ! ~ * ' ( )Everything else including : / ? # @ & =Single URL parameter value
encodeURIA–Z a–z 0–9 - _ . ! ~ * ' ( ) ; , / ? : @ & = + $ #Spaces and non-ASCII charactersEntire valid URL string

Frequently Asked Questions

What is URL Percent-Encoding?

Percent-encoding (also known as URL encoding) replaces unprintable or reserved URL characters with a % sign followed by two hexadecimal digits representing the ASCII character code.

What is the difference between encodeURI and encodeURIComponent?

encodeURI preserves URL structure characters like colons (:), slashes (/), question marks (?), and ampersands (&). encodeURIComponent encodes all special characters, making it ideal for individual query parameter values.

Why are spaces encoded as %20 or + ?

In standard URI percent-encoding (RFC 3986), spaces are encoded as %20. In application/x-www-form-urlencoded query strings, spaces are historically represented as a + symbol.