Developer
URL Encoding Explained — When and How to Encode URLs
Learn about URL encoding (percent encoding), why it's needed, and how to encode/decode URLs with our free online tool.
URL encoding (also called percent encoding) converts special characters in URLs into a format that can be safely transmitted over the internet.
Why Do We Need URL Encoding?
URLs can only contain a limited set of ASCII characters. Characters outside this set must be encoded:
- Spaces →
%20 - Chinese/Japanese →
%E4%B8%AD%E6%96%87 - Ampersands →
%26 - Plus signs →
%2B
Common URL Encoded Characters
| Character | Encoded |
|---|---|
| space | %20 |
| ! | %21 |
| # | %23 |
| $ | %24 |
| & | %26 |
| / | %2F |
| = | %3D |
| ? | %3F |
| @ | %40 |
When to Encode
- Query parameters:
?q=hello%20world - Path segments:
/files/my%20document.pdf - API requests: Ensuring special characters don't break the request
- Form data: Application/x-www-form-urlencoded format
When NOT to Encode
- The URL scheme (
http://,https://) - Host name (
example.com) - Reserved characters that have structural meaning (
:,/,?,#,&,=)
Use our free URL encoder/decoder to encode or decode URLs instantly.