URL Encoder Decoder
Encode URLs to make them web-safe by converting special characters to percent-encoded format, or decode URL-encoded strings back to readable text. Essential for web development, API work, and handling URLs with special characters.
—
Send feedback
💡 Share your idea or report a problem
✓ Thanks! We'll take a look.
Learn more
How It Works
The formula, explained simply
URL encoding, also known as percent encoding, converts special characters in URLs into a format that can be safely transmitted over the internet. When you type a URL with spaces or symbols like @, &, or ?, these characters have special meanings in web protocols and need to be encoded to avoid confusion.
The encoding process replaces each special character with a percent sign (%) followed by two hexadecimal digits representing the character's ASCII value. For example, a space character becomes %20, an @ symbol becomes %40, and a question mark becomes %3F. This URL encoder decoder handles both directions - converting readable text to encoded format and vice versa.
Modern web browsers automatically encode URLs when you type them in the address bar, but developers working with APIs, query parameters, or programmatic URL generation often need manual control over this process. The decoder function reverses the process, converting percent-encoded strings back to human-readable format for debugging or display purposes.
When To Use This
Right tool, right situation
Use URL encoding when constructing URLs programmatically, especially for query parameters containing user input or data with special characters. This is essential for search forms, API requests with parameters, and any situation where you're building URLs dynamically in code.
Decoding becomes necessary when processing URL parameters on the server side, debugging encoded URLs, or displaying user-friendly versions of encoded strings in logs or interfaces. Web developers frequently use URL decoding when analyzing traffic logs or troubleshooting API calls.
The tool is particularly valuable for testing API endpoints, preparing data for web forms, and ensuring proper URL formatting before making HTTP requests. If you're working with international characters or symbols in URLs, proper encoding prevents broken links and ensures cross-platform compatibility.
Common Mistakes
Why results sometimes look wrong
A common mistake is encoding URLs that are already encoded, creating double-encoding like %2520 (which represents an encoded space %20 that got encoded again). Always check if your input is already encoded before applying additional encoding.
Another frequent error occurs when manually constructing encoded URLs by only encoding spaces but forgetting other special characters like &, =, or ?. These characters have specific meanings in URL structure, so leaving them unencoded in query parameters can break URL parsing.
When decoding, be careful with malformed input containing incomplete percent sequences like %2G or %A. These will cause decoding errors because G is not a valid hexadecimal digit. Always validate that percent-encoded strings use proper format before attempting to decode them.
The Math
Worked examples and deeper derivation
URL encoding follows the ASCII character encoding standard where each character has a numeric value from 0 to 127. Special characters are converted to their hexadecimal representation using base-16 numbering (digits 0-9 and letters A-F).
For example, the space character has ASCII value 32. Converting 32 to hexadecimal gives 20, so the encoded form is %20. The @ symbol has ASCII value 64, which converts to hexadecimal 40, resulting in %40. Letters and numbers (A-Z, a-z, 0-9) plus some symbols like hyphens and underscores are considered 'unreserved' and don't require encoding.
The decoding process reverses this by reading the two hexadecimal digits after each % sign, converting them back to decimal, and then to the original character. This mathematical transformation ensures reliable data transmission while maintaining the original meaning of the text.
Common questions
Need something this doesn't cover?
Suggest a tool — we'll build it →