Back to Home
Published: June 2026•By Web Util Slyce Team•6 min read
URL Encoding — Character Reference
A complete reference for URL encoding (percent-encoding). Encode and decode URLs instantly with our URL Encode/Decode tool.
What is URL Encoding?
URL encoding (also called percent-encoding) converts characters that are not allowed in URLs into a safe format. Characters are replaced with a % followed by their two-digit hexadecimal ASCII code. For example, a space becomes %20 and a slash becomes %2F.
Complete Encoding Table
Reserved Characters (always encoded)
:%3A
/%2F
?%3F
#%23
[%5B
]%5D
@%40
!%21
$%24
&%26
'%27
(%28
)%29
*%2A
+%2B
,%2C
;%3B
=%3D
Unsafe Characters (should be encoded)
%20
"%22
%%25
<%3C
>%3E
\%5C
^%5E
`%60
{%7B
|%7C
}%7D
~%7E
URL-Safe Characters (never encoded)
A-ZA-Z
a-za-z
0-90-9
--
__
..
Practical Examples
Before
https://example.com/search?q=hello world
After
https://example.com/search?q=hello%20world
Before
https://example.com/path with spaces/file.html
After
https://example.com/path%20with%20spaces/file.html
Before
https://example.com/?name=John&company=Acme Co
After
https://example.com/?name=John&company=Acme%20Co
Before
https://example.com/?q=a+b (literal plus)
After
https://example.com/?q=a%2Bb
Before
https://example.com/file#section
After
https://example.com/file%23section
Encoding in Programming
JavaScript
encodeURIComponent(str)Encodes a URI component
JavaScript
decodeURIComponent(str)Decodes a URI component
JavaScript
encodeURI(str)Encodes a full URI (preserves /?#)
Python
urllib.parse.quote(str)URL-encode a string
Python
urllib.parse.unquote(str)URL-decode a string
PHP
urlencode($str)URL-encode a string
PHP
urldecode($str)URL-decode a string