What is URL/URI encoding?
URL encoding (also known as percent-encoding) is a mechanism for encoding information in a Uniform Resource Identifier (URI) under certain circumstances. URL encoding is used when placing text in a query string to avoid it being interpreted as URL syntax, and to handle characters that are not permitted in URLs.
When text contains special characters, spaces, new lines, or other reserved characters, they cannot be properly used in a URL. URL encoding solves this problem by replacing these characters with a sequence consisting of a percent sign (%) followed by two hexadecimal digits representing the ASCII code of the character.
How URL Encoding Works
- Alphanumeric characters (A-Z, a-z, 0-9) remain unchanged
- Spaces are converted to "+" or "%20" (this tool uses "%20")
- Special characters are converted to their hexadecimal ASCII values preceded by a percent sign (%)
- Reserved characters in URLs (like ?, &, =, /, :, etc.) are also encoded
- Non-ASCII characters (like é, ñ, 漢) are first UTF-8 encoded, then each byte is percent-encoded
Example of URL encoded text
Original text:
“A World of Dew” by Kobayashi Issa
A world of dew,
And within every dewdrop
A world of struggle. URL encoded text:
%E2%80%9CA+World+of+Dew%E2%80%9D+by+Kobayashi+Issa%0A%0AA+world+of+dew%2C%0A%0AAnd+within+every+dewdrop%0A%0AA+world+of+struggle.+Common URL Encoding Examples
| Character | URL Encoded | Description |
|---|---|---|
| Space | %20 | Spaces in URLs must be encoded |
| & | %26 | Used to separate query parameters |
| ? | %3F | Marks the beginning of the query string |
| = | %3D | Separates parameter names from values |
| / | %2F | Path separator in URLs |
| + | %2B | Plus sign must be encoded |
| % | %25 | Percent sign itself must be encoded |
Parameters
- Input text: Any text you want to encode for use in a URL
Common Use Cases
- Creating query parameters in URLs
- Encoding form data for HTTP GET and POST requests
- Handling user input that will be included in URLs
- Creating links with non-ASCII characters
- Passing complex data structures in URLs
Tip:
When working with URLs, remember that different parts of a URL have different encoding rules. For example, the query string has different rules than the path. This tool follows the standard encoding for query parameters.
Related Tools
- URL Decode - Convert URL-encoded text back to its original form
- Base64 Encode - Convert text to Base64 encoding
- Hex Encode - Convert text to hexadecimal representation
- HTML Escape - Escape text for use in HTML
- JavaScript Escape - Escape text for use in JavaScript
All Tools
See all available tools