URL Encoder/Decoder

Text to Encode

0 characters

encodeURIComponent()

Encodes all special characters including :, /, ?, #, &, =, +, etc.

encodeURI()

Preserves URI-safe characters like :, /, ?, #, &, =, +, @, etc.

Common URL Encoding Reference

CharacterEncodedDescription
%20Space
!%21Exclamation mark
#%23Hash
$%24Dollar sign
&%26Ampersand
'%27Single quote
(%28Open parenthesis
)%29Close parenthesis
*%2AAsterisk
+%2BPlus sign
,%2CComma
/%2FForward slash
:%3AColon
;%3BSemicolon
=%3DEquals sign
?%3FQuestion mark
@%40At sign
[%5BOpen bracket
]%5DClose bracket
{%7BOpen brace
}%7DClose brace

About URL Encoding

What is URL Encoding?

URL encoding (percent-encoding) replaces unsafe characters in URLs with a % followed by two hexadecimal digits representing the character's ASCII value. This ensures URLs are transmitted correctly across the internet.

encodeURI vs encodeURIComponent

encodeURI() encodes a full URI but preserves characters like :, /, ?, and # that have special meaning in URLs. encodeURIComponent() encodes everything, making it ideal for query parameter values.

When to Use Which

  • Use encodeURIComponent() for query parameter values
  • Use encodeURI() for encoding a full URL string
  • Use decodeURIComponent() to decode individual values
  • Use decodeURI() to decode a complete URL

Example

Input: https://example.com/path?q=hello world&lang=en
encodeURI: https://example.com/path?q=hello%20world&lang=en
encodeURIComponent: https%3A%2F%2Fexample.com%2Fpath%3Fq%3Dhello%20world%26lang%3Den