URL Encoder / Decoder

Percent-encode a value for a query string, encode a whole URL without breaking its structure, or decode an encoded URL back to readable text — with a breakdown of host, path and query parameters. Runs entirely in your browser; nothing is uploaded.

How this tool works

The two encode modes use the browser's own encodeURIComponent and encodeURI, so the output is exactly what JavaScript would produce. Decoding checks every percent-escape first and points at the offending one when it's malformed, rather than returning the bare “URI malformed” the browser gives you. When the input is a complete URL with a scheme and host, the breakdown card splits it into protocol, host, port, path and fragment, and lists each query parameter with its decoded value.

Everything runs in your browser — nothing you paste is sent to a server, so it's safe to use on links that contain tokens or session IDs.

Which characters get encoded, and why

A percent-encoded character is a % followed by two hexadecimal digits that give one byte. Characters outside ASCII are first converted to UTF-8 bytes, with one escape per byte. There are three groups:

  • Unreserved: never need encoding. Letters A-Z and a-z, digits 0-9, and the four characters - _ . ~. Both encoders here leave them alone.
  • Reserved: encode them when they are data rather than structure. : / ? # [ ] @ ! $ & ' ( ) * + , ; =. Several do a job inside a URL: ? starts the query string, & separates parameters, = splits a name from its value, # starts the fragment and / separates path segments. When one of them appears inside a value it must be encoded, or the URL means something other than what you intended.
  • Everything else: always encode. Spaces, quotes, angle brackets, curly braces, pipes, carets, backticks, the % sign itself and every non-ASCII character.

Encode component vs Encode URL, character by character

The two modes are JavaScript's encodeURIComponent and encodeURI, so this table is exactly what they return for the same character:

CharacterEncode componentEncode URL
space%20%20
&%26unchanged
=%3Dunchanged
?%3Funchanged
#%23unchanged
/%2Funchanged
:%3Aunchanged
+%2Bunchanged
%%25%25
<%3C%3C
'unchangedunchanged
é%C3%A9%C3%A9

Two details catch people out. Encode URL leaves every reserved character alone, so it is only safe on a whole URL whose structure is already right, and it will leave a stray & or = sitting inside a value. And neither mode encodes ! ' ( ) *, although the standard lists them as reserved. They rarely matter in a URL, but an apostrophe inside a single-quoted HTML attribute or shell command will. The same input through both modes:

Input
https://example.com/a path?q=a b&x=1#top

Encode component
https%3A%2F%2Fexample.com%2Fa%20path%3Fq%3Da%20b%26x%3D1%23top

Encode URL
https://example.com/a%20path?q=a%20b&x=1#top

The first result is no longer a working link, which is the point of the second mode: Encode component is for one value at a time, and Encode URL is for a finished address that only needs its spaces fixed.

Space: %20 or +

In a path, a space is always %20 and a + is a literal plus sign. In a query string, + means a space only when the data came from an HTML form (application/x-www-form-urlencoded), and %20 works there too. JavaScript shows the split: URLSearchParams writes q=red+shoes+%26+boots&note=50%25+off&x=a%2Bb, while encodeURIComponent writes every space as %20. CheckSEO's UTM Builder builds links with URLSearchParams, so its output reads utm_campaign=spring+sale+%26+clearance; both spellings are valid. The danger is decoding with the wrong rule. The decoder's "Treat + as space" switch is on by default, so a+b%20c decodes to a b c; with it off you get a+b c. Turn it off for paths and for any value where the plus is real.

Multi-byte UTF-8 characters

One character outside ASCII becomes two to four escapes, one per byte, so the encoded form is much longer than the text it stands for: é is one character and %C3%A9 is six.

CharacterCode pointUTF-8 bytes (hex)Percent-encoded
éU+00E9C3 A9%C3%A9
€U+20ACE2 82 AC%E2%82%AC
😀U+1F600F0 9F 98 80%F0%9F%98%80

Browsers often show the decoded text in the address bar but send the encoded form, so use the encoded form in code, tags and sitemaps. A byte such as %E9 on its own is how Latin-1 writes é; it is not valid UTF-8, which is why the decoder reports it.

Double encoding: how to spot it

Double encoding means encoding text that is already encoded, so every % becomes %25. The giveaway is %25 followed by two hex digits, as in %2520 (a space) or %25C3 (the start of é).

Text           café & crème
Encoded once   caf%C3%A9%20%26%20cr%C3%A8me
Encoded twice  caf%25C3%25A9%2520%2526%2520cr%25C3%25A8me

To confirm, paste the string into Decode mode. One pass should give readable text; if you still see %C3%A9 or %20, decode again, and the number of passes is the number of times it was encoded. Common causes are running Encode URL on an address that is already encoded (it turns https://example.com/caf%C3%A9?q=a%20b into https://example.com/caf%25C3%25A9?q=a%2520b), a framework and hand-written code both encoding the same value, and a redirect rule that re-encodes its destination. The server then looks for a path that literally contains the characters %C3%A9, which often means a 404 or a copy of the real page.

Where this matters in SEO work

WhereWhat to doWhat goes wrong otherwise
Query parameter values, such as search terms and filtersEncode each value with Encode component, then join the name=value pairs with & yourself.A raw & or # inside a value ends it early, and the rest becomes a different parameter or a fragment.
UTM values (see what UTM parameters are)Encode the value: spring%20sale%20%26%20clearance.Written raw as spring sale & clearance, it is read as the campaign spring sale plus a stray parameter named clearance, so the campaign name is cut off at the ampersand.
Redirect destinations passed as a value, such as ?next=Encode the destination once with Encode component.Encoded twice, one decode returns https%3A%2F%2F… text instead of an address, and the redirect usually fails. Test the result with the Redirect Chain Checker.
XML sitemap <loc> valuesPercent-encode first, then escape for XML, so & is written &amp;: ?q=caf%C3%A9&amp;sort=price.A raw ampersand makes the file invalid XML. Run the finished file through the Sitemap Validator.
Canonical tags, hreflang and internal linksUse the percent-encoded UTF-8 form with uppercase hex digits, the same way everywhere.One page shows up under two spellings, café versus caf%C3%A9 or %c3%a9 versus %C3%A9, and tools that compare URLs as plain text count them as different URLs.

Frequently asked questions

What's the difference between "Encode component" and "Encode URL"?

Encode component (encodeURIComponent) escapes everything that has a meaning inside a URL — including / ? & = # and + — so a value survives intact when you drop it into a query string. Encode URL (encodeURI) leaves those structural characters alone and only escapes characters that can't appear in a URL at all, such as spaces and non-ASCII letters. Use the first for individual values and the second when you have a complete URL that just needs its spaces and accents fixed.

Why does a space sometimes become %20 and sometimes +?

Percent-encoding proper uses %20. The + convention comes from HTML form submission (application/x-www-form-urlencoded), which is why you see it in query strings generated by forms and by many server frameworks. A + in a path is a literal plus sign, but in a query string it usually means a space. The decoder's "Treat + as space" switch covers both cases; turn it off when decoding a path or when a + is genuinely a plus.

Why do I get a "malformed percent-escape" error?

Every % in encoded text must be followed by exactly two hexadecimal digits. A bare % ("50% off"), a truncated escape at the end of a copied string (%E0%A4%A), or a % followed by non-hex characters all fail. If you want a literal percent sign it has to be written as %25. A second kind of error appears when the escapes are well-formed but the bytes aren't valid UTF-8 — usually a multi-byte character cut in half, or text encoded in an older charset such as Latin-1.

Should I encode the whole URL with encodeURIComponent?

No — that turns https://example.com/path into https%3A%2F%2Fexample.com%2Fpath, which no longer works as a link. Encode each value separately and assemble the URL around them. The one time you do want the whole thing component-encoded is when the URL itself is a value, for example a redirect target or a share link passed as ?url=…

What is double encoding and how do I spot it?

Double encoding is encoding text that was already encoded, so %20 becomes %2520 and %26 becomes %2526. It usually happens when two layers of code each escape the same value. The symptom is that decoding once still leaves percent signs in the output — run Decode a second time to see the real value, then fix the code so only one layer does the encoding.

Which characters never need to be percent-encoded?

Letters A to Z and a to z, digits 0 to 9, and the four characters - _ . ~ (the unreserved set in RFC 3986). Both encoders on this page leave them alone. Encoding one of them is legal and decodes to the same character, but it gives you a differently spelled URL, which matters when other tools compare URLs as plain text. Every other character is either reserved, so encode it when it is data rather than structure, or must always be encoded.

Do %C3%A9 and %c3%a9 mean the same thing?

For decoding, yes: the hex digits are case-insensitive, and decoding either one gives é. The standard recommends uppercase, though, and anything that compares URLs as plain text sees two different strings. Use uppercase everywhere, which is what both encoders here produce, so the same page is never spelled two ways in links, canonical tags and sitemaps.

How do I fix double-encoded URLs that are already on my site?

Fix the source first: find the layer that encodes a second time, such as a template that encodes a value your CMS already encoded. Then 301 redirect the double-encoded URLs that were crawled to the correct ones, and update internal links, sitemaps and canonical tags. To find them, search a crawl export or your server logs for %25 followed by two hex digits, such as %2520 or %25C3. A bare %25 on its own can be legitimate, because it is how a literal percent sign is written.

How do I encode a domain name with accented letters?

You don't. Percent-encoding applies to the path, query and fragment, while a domain name with non-ASCII letters is converted to Punycode: café.com becomes xn--caf-dma.com. Running Encode URL over such a domain would produce a host with %C3%A9 in it, which is not a valid host name. Paste the full URL, with its scheme, and the breakdown card shows the host in its Punycode form.

Related tools

We use cookies to analyze site usage and improve your experience. You can decline non-essential cookies. Privacy Policy