How to encode or decode a URL
- Choose Encode to make text safe for a URL, or Decode to make an encoded URL readable.
- Paste your text. The result appears instantly.
- When decoding a full URL, its query parameters are listed in a table for easy reading.
Characters that must be encoded
Spaces, quotes, < >, #, % and non-ASCII characters (like é or 中) always need encoding. Inside a query value, &, =, ? and / must also be encoded, or they will be read as part of the URL structure. That is the most common cause of broken tracking links and API calls.
Examples
Tom & Jerry→Tom%20%26%20Jerrycafé→caf%C3%A9a/b?c=d→a%2Fb%3Fc%3Dd(component mode)
Related: Base64 Encoder and QR Code Generator for sharing links.
How percent-encoding works
Each character that is not allowed in a URL is converted to its UTF-8 bytes, and each byte is written as % followed by two hexadecimal digits. A space is the single byte 0x20, so it becomes %20. The character é is two bytes in UTF-8 (0xC3 0xA9), so it becomes %C3%A9. Letters, digits and the characters - _ . ~ never need encoding.
Encoding query parameters correctly
When building a link with parameters, encode each value separately rather than the whole URL. For example, to search for “rock & roll”, the URL should be ?q=rock%20%26%20roll. If the & is not encoded, the server sees two parameters: q=rock and an empty parameter called roll. This is a frequent bug in marketing links, redirect URLs and API calls.
Double encoding
If you see sequences like %2520 in a URL, the text has been encoded twice: % was itself encoded as %25. Decode once to see %20 and once more to get the space. Double encoding usually happens when a value is encoded by your code and then again by a library or framework.
UTM tracking links
Campaign names in UTM parameters often contain spaces or symbols. Encode them before pasting into ads or newsletters, and decode a tracking URL here to check exactly what will be recorded in your analytics.
URL encoding in code
- JavaScript:
encodeURIComponent(value)anddecodeURIComponent(text); build query strings withURLSearchParams. - Python:
urllib.parse.quote(value, safe='')andurllib.parse.unquote(text). - PHP:
rawurlencode()andrawurldecode(). - Java:
URLEncoder.encode(value, StandardCharsets.UTF_8)(note: it encodes spaces as +).
Use these when building URLs in code instead of concatenating strings by hand, to avoid broken links and security issues.
Frequently asked questions
What is URL encoding?
URL encoding (percent-encoding) replaces characters that are not allowed or have special meaning in URLs with a % followed by two hexadecimal digits, for example a space becomes %20.
encodeURIComponent or encodeURI?
Use component mode for a single query value or path segment: it also encodes &, =, / and ?. Use full-URL mode to clean up an entire URL while keeping its structure intact.
Why do I see + instead of %20?
HTML forms encode spaces as "+" in query strings. The decoder treats "+" as a space for that reason.