Home / Tech / URL Encoder
URL Encoder/Decoder
URL Encoding Explained
URL encoding (percent-encoding) converts special characters into %XX format so
they can safely appear in URLs. Spaces become %20,
exclamation marks become %21,
etc.
Hello World!Hello%20World%21💡 Expert Tip: Don't Encode the Entire URL
"The #1 mistake: encoding 'http://example.com' → 'http%3A%2F%2Fexample.com'. That's a broken URL." — Alex Chen
✅ Right: 'http://api.com?q=' + encodeURIComponent('search term')
❌ Wrong: encodeURIComponent('http://api.com?q=search term')
⚠️ Common Mistakes
1. Encoding the Entire URL
Running encodeURIComponent('http://example.com') produces
'http%3A%2F%2Fexample.com'—a useless string. Only encode query parameters and
path segments, not protocols or domains.
2. Using Deprecated escape()
JavaScript's escape() is deprecated and doesn't follow URL encoding standards.
It produces non-standard output like %u sequences. Always use
encodeURI() or encodeURIComponent().
3. Double Encoding
Encoding 'Hello%20World' again produces 'Hello%2520World' (% →
%25). Check if data is already encoded before encoding again.
4. Forgetting to Encode Special Characters in Query Params
'?name=John&age=30' looks fine, but '?email=user@example.com'
breaks because @ needs encoding. Always use encodeURIComponent() for query
values.