URL Encoder / Decoder

Percent-encode text for safe use in URLs, or decode an already-encoded URL back to readable text.

Plain URL / text

Encoded URL

Result will appear here.

Example input

https://example.com/search?q=hello world

Example output

https://example.com/search%3Fq%3Dhello%20world

What is a URL Encoder / Decoder?

URLs can only safely contain a limited set of characters — letters, digits, and a handful of punctuation marks. Anything outside that set (spaces, ampersands, non-English characters, symbols like & or #) has to be percent-encoded: replaced with a % followed by the character's hex code, like %20 for a space. Without this encoding, those characters would either break the URL's structure or get silently mangled by whatever's parsing it. This tool converts text to its properly percent-encoded form, or reverses an encoded URL back into readable text.

When to use it

This comes up whenever you're building a URL by hand that includes user input or special characters — a search query with spaces, a redirect URL passed as a parameter, a filename with symbols in it. It's also useful for decoding a URL you've copied that looks like gibberish (full of %XX sequences) so you can actually read what it says, which is common when debugging a redirect chain or inspecting a tracking link.

How it works

This tool uses JavaScript's built-in encodeURIComponent() and decodeURIComponent() functions, with an option to switch to encodeURI()/decodeURI() instead. The distinction matters: encodeURIComponent() escapes nearly everything non-alphanumeric, which is correct when encoding a single value that will become part of a URL (like a query parameter), while encodeURI() leaves structural characters like /, ?, and & untouched, which is correct when encoding an entire URL that should keep its existing structure intact.

Frequently asked questions

What's the difference between encodeURI and encodeURIComponent?

encodeURIComponent() escapes every special character, including / and &, making it correct for encoding a single value (like a search term) that will be inserted into a URL. encodeURI() leaves URL-structural characters like /, ?, and & alone, making it correct for encoding a complete URL that should stay a valid, working link.

Why do spaces become %20 in URLs?

Space isn't a valid character in a URL, so it must be percent-encoded. %20 is the hex code for the space character (0x20 in ASCII). You may also see + used for spaces specifically within query strings, which is an older, application/x-www-form-urlencoded convention rather than strict URL encoding.

Why did decoding my URL produce garbled or incorrect text?

This usually happens when the string wasn't properly encoded to begin with, or when it's been encoded more than once (double-encoding). If decoding once still leaves %-sequences in the output, try decoding it a second time.