Input
Output
About URL Encoding
What is URL Encoding?
URL encoding (also called percent-encoding or application/x-www-form-urlencoded) converts special characters into a format safe for transmission in URLs. It replaces unsafe characters with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII value. Standardized in RFC 3986, URL encoding ensures URLs work correctly across all browsers and servers.
Why Encode URLs?
- Special Characters: Spaces, <, >, ", # and other characters break URLs if not encoded
- Query Parameters: Form data containing special characters must be properly encoded
- Internationalization: Non-ASCII characters (é, ñ, 中文) require encoding for URL compatibility
- Data Integrity: Ensures query parameters aren't misinterpreted as URL structure
- Security: Prevents injection attacks by properly encoding user input
Real-World Use Cases
- Search Queries: Google search: "machine learning trends" → q=machine%20learning%20trends
- Form Submission: HTML forms automatically encode data when method="POST"
- API Requests: Build safe query parameters for REST APIs
- Redirects: Pass URLs as parameters: ?redirect=https%3A%2F%2Fexample.com
- Email Links: Encode recipients and subjects: mailto:user@example.com?subject=Hello%20World
Example
Raw Text: Hello, World! How are you?
URL Encoded: Hello%2C%20World%21%20How%20are%20you%3F
Common Encodings:
- Space → %20 or +
- ! → %21
- ? → %3F
- = → %3D
- & → %26