URL Encoder / Decoder
Percent-encode and decode URLs.
What URL Encoding Is For
URLs have reserved characters — ?, &, #, /, spaces, and many others — that have special meaning. When you want to pass those characters as data (say, in a query parameter), you must "percent-encode" them: each byte is replaced with % followed by its two-digit hexadecimal representation. A space becomes %20, an ampersand becomes%26, and so on.
Encode vs. Decode
Use encode when you're about to put text into a URL (like a search query). Use decode when you're reading a URL and want the human-readable version back.
encodeURI vs. encodeURIComponent
JavaScript has two built-in functions. encodeURI() leaves URL structure characters like :, /, and? alone — use it to sanitize a full URL. encodeURIComponent() encodes everything except letters, digits, and a small set of safe symbols — use it when encoding a single piece of data (like a query parameter value). This tool uses encodeURIComponent().
Common Use Cases
- Encoding search terms in query strings.
- Passing JSON payloads via URL parameters.
- Building OAuth redirect URIs that themselves contain URLs.
- Debugging malformed API requests.