Encode text for safe use in URLs. Convert special characters, spaces, and reserved characters to percent-encoded format for proper URL parameter handling.
URL encoding (also called percent-encoding) converts characters into a format that can be transmitted over the Internet. Reserved characters like ?, &, =, and spaces have special meanings in URLs and must be encoded when used as data values. This ensures URL parameters are parsed correctly by web servers.
Encoded Character = % + Hexadecimal ASCII ValueEach character that needs encoding is replaced with a percent sign (%) followed by its two-digit hexadecimal ASCII value. For example, a space becomes %20, a question mark becomes %3F, and an ampersand becomes %26. Modern URLs often use + for spaces in query strings.
| Input | Output |
|---|---|
| Hello World | Hello%20World |
| price=100&discount=20% | price%3D100%26discount%3D20%25 |
| https://example.com/search?q=hello world&lang=en | https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dhello%20world%26lang%3Den |