URL Encode / Decode
Encode text for safe use in URLs or decode an encoded string.
Encode text so it can be safely used inside a URL, or decode a percent-encoded URL string back into its original readable form.
How URL Encode / Decode Works
URLs can only reliably contain a limited set of characters. Encoding replaces anything outside that safe set — spaces, symbols like &, ?, and =, and non-ASCII characters — with a "%" followed by the character's hexadecimal byte value, so the URL remains valid and unambiguous wherever it's used.
Decoding reverses this: it finds each "%XX" sequence and converts it back to the original character, restoring readable text from the encoded URL.
Encoding is essential whenever text is inserted into a query string or path segment, since unencoded special characters (like "&" or "?") can be misread as part of the URL's structure rather than as your actual data.
See It In Action
Who Uses URL Encode / Decode and Why
- Building a link that passes user-entered text (like a search query) as a URL parameter without breaking the link if it contains spaces or special characters.
- Decoding a long, percent-encoded URL copied from an address bar or API response to read what it actually says.
- Preparing a value containing an ampersand or question mark to be safely embedded inside a query string without being misread as part of the URL's structure.
- Troubleshooting a broken link where special characters in a parameter are interfering with how the URL is parsed.
Mistakes to Avoid
- Encoding an entire URL (including https:// and the domain) when only a specific parameter value needs encoding — this breaks the URL's actual structure instead of protecting it.
- Double-encoding a value that's already been percent-encoded, which turns a valid %20 into %2520 and produces the wrong result when decoded downstream.
- Assuming a plus sign and %20 are always interchangeable — %20 is standard percent-encoding for a space anywhere in a URL, while a plus sign specifically means a space only within query strings and form submissions, not in every part of a URL.
Tips for Best Results
- Only encode the specific value going into a parameter, not the surrounding URL structure — encode the piece of user input, then assemble it into the full URL afterward.
- If a URL looks broken because of unencoded special characters, decode it first to see the intended content clearly, then re-encode just the parts that need it.
Fixing Common Problems
The decoded text still has percent signs and codes in it. — The text may have been encoded twice — try running it through the decoder a second time, or check whether the source that generated it double-encoded the value by mistake.
A link works in some places but breaks when pasted elsewhere. — Unencoded special characters (spaces, ampersands, question marks) in the URL can be interpreted differently by different systems — encode the affected parameter values before sharing the link.
Terms Explained
Percent-encoding: The scheme of replacing a special character with a percent sign followed by its hexadecimal code, used to safely represent characters that would otherwise break a URL's structure.
Query string: The part of a URL after the ? that holds key-value parameters, where a plus sign is conventionally used to represent a space.
Reserved characters: Characters like /, ?, #, and & that have a specific structural meaning within a URL and must be encoded when used as literal data rather than structure.