What Is URL Encoding?
URL encoding, also called percent encoding, converts characters that are not safe to use in a URL into a percent sign followed by two hexadecimal digits. For example, a space becomes %20, and an ampersand becomes %26. A URL encoder performs this conversion automatically, while a URL decoder reverses it so you can read the original text.
Why URLs Need Encoding
URLs have a reserved set of characters with special meanings, such as ?, &, =, and #. If your data contains these characters literally, the browser or server will misinterpret them. Encoding them ensures the data is transmitted exactly as intended, whether it appears in a path, a query string, or a fragment.
How URL Encoding Works
Each unsafe character is replaced by a percent sign and its byte value in hexadecimal. The encoding skips unreserved characters like letters, digits, hyphens, underscores, periods, and tildes, which can be used as-is. JavaScript provides encodeURIComponent and decodeURIComponent, which our tool uses to handle full strings correctly.
When to Encode and Decode
- Building query strings for API requests
- Passing special characters in form submissions
- Decoding URLs copied from analytics or logs
- Debugging redirects and campaign tracking links
For other text transformation tools, try our JSON formatter or the Base64 encoder decoder.