URL Encoder & Decoder

Encode full URLs or URL components — or decode percent-encoding back to readable text — instantly, live as you type. This free URL encoder and decoder explains the difference between encodeURI and encodeURIComponent, flags malformed input in plain English, and includes a quick reference table of the characters you will meet most.

Encode & Decode URLs

How to Use the URL Encoder & Decoder

Both directions convert live — type on either side and the other updates:

  1. Pick a mode. Encoding one value for a query string — a search term, a name, a redirect target? Keep Component (encodeURIComponent), the default and the right choice 90% of the time. Encoding an entire address that already has its https://, slashes, and query structure? Switch to Full URL (encodeURI) so the structure survives.
  2. To encode: type or paste readable text into the Decoded box. The encoded form appears instantly on the right.
  3. To decode: paste percent-encoded text (full of %20s and %26s) into the Encoded box. Readable text appears on the left.
  4. Switching modes re-converts whatever is in the boxes, so you can compare encodeURI and encodeURIComponent output on the same input with one click.
  5. Copy the encoded result with the button, or Clear both boxes to start fresh.

Malformed input — a lone %, a truncated triplet like %2, or non-hex digits after % — produces a plain-English error instead of a silent wrong answer, and tells you which mode it failed under.

encodeURI vs encodeURIComponent: The Difference That Matters

JavaScript ships two encoders because URLs have two jobs: structure and content. encodeURI assumes you are handing it a complete, working URL and encodes only what would break it — spaces, non-ASCII characters, and a few others — while deliberately leaving the structural characters (: / ? # [ ] @ ! $ & ' ( ) * + , ; =) alone. encodeURIComponent assumes you are handing it one piece of a URL and escapes everything that could be mistaken for structure, leaving only A–Z a–z 0–9 - _ . ! ~ * ' ( ) untouched.

Whole URL → encodeURI  ·  One value inside a URL → encodeURIComponent

The classic bug is using the wrong one. Encode a full URL with encodeURIComponent and your https:// becomes https%3A%2F%2F — a dead link. Encode a query value with encodeURI and a user's & survives to split your query string in half, or a # truncates everything after it into a fragment. The rule is mechanical: if the string already contains URL syntax you want to keep, it is a URI — use encodeURI. If it is data being placed into URL syntax, it is a component — use encodeURIComponent.

Worked Example

Take a search URL with a tricky query — a user typed fish & chips? — and watch the two modes diverge:

StepInputResult
1. Full URL, encodeURIhttps://example.com/search?q=fish & chips?https://example.com/search?q=fish%20&%20chips? — structure intact, spaces escaped
2. Same URL, encodeURIComponenthttps://example.com/search?q=fish & chips?https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dfish%20%26%20chips%3F — everything escaped, link destroyed
3. Just the value, encodeURIComponentfish & chips?fish%20%26%20chips%3F — safe to append after ?q=
4. Decode it backfish%20%26%20chips%3Ffish & chips? — exact round trip

Step 1 versus step 2 is the whole lesson in one glance: the right encoder preserves meaning, the wrong one preserves nothing. Try all three inputs in the tool above and flip the mode radio to feel the difference.

Common Encoded Characters Reference

You do not need to memorize these — the tool does the work — but recognizing the frequent ones makes debugging URLs dramatically faster:

CharacterEncodedCharacterEncoded
space%20+%2B
!%21,%2C
#%23/%2F
$%24:%3A
&%26;%3B
'%27=%3D
(%28?%3F
)%29@%40
*%2A[%5B
é%C3%A9]%5D

Note é → %C3%A9: non-ASCII characters are first encoded as UTF-8 bytes, then each byte is percent-encoded. One character can become two, three, or four triplets — which is why encoded URLs with international text look so long.

Limitations

Percent-encoding is a transport trick with sharp edges. + means space only in form data — HTML forms submit spaces as +, but in a URL path + is a literal plus sign. Decoding a path with form rules (or vice versa) corrupts data; this tool treats + literally, which is correct for URLs. Double-encoding is silent: encoding twice turns %20 into %2520, and nothing complains — the URL just quietly stops meaning what you intended. decodeURI will not decode everything: it deliberately leaves encoded reserved characters like %23 (#) alone, so decoding a component with the full-URL decoder gives a half-decoded result. Encoding is not validation: an encoded URL can still be a phishing link, and encoding user input does not make it safe for HTML or SQL — those need their own escaping. And length limits still apply: browsers and servers cap URL length (around 2,000 characters in practice for Internet Explorer-era compatibility, ~8KB on many servers), so a heavily encoded long value can push a GET request over the edge — that is what POST bodies are for.

Guides for This Tool

Frequently Asked Questions

What is URL encoding?
URL encoding (percent-encoding) replaces characters that are unsafe or reserved in a URL with a % followed by two hexadecimal digits — the character's byte value. A space becomes %20, an ampersand becomes %26, and so on. It exists because URLs were designed around a limited ASCII alphabet, and everything else must be smuggled through in this escaped form.
What is the difference between encodeURI and encodeURIComponent?
encodeURI encodes a complete URL and leaves its structure intact — it will not touch : / ? # & = and the other characters that give a URL meaning. encodeURIComponent encodes a single component (like one query value) and escapes everything except letters, digits, and - _ . ! ~ * ' ( ). Rule of thumb: whole URL, use encodeURI; a value you are dropping into a URL, use encodeURIComponent.
When should I use encodeURIComponent?
Whenever user input or dynamic data becomes part of a URL — search boxes, form values placed in query strings, filenames in download links, or redirect targets. If a user types fish & chips and you glue it raw into ?q=fish & chips, the & splits your query in two; encodeURIComponent turns it into fish%20%26%20chips and the URL stays intact.
What does %20 mean in a URL?
It is an encoded space — 0x20 is the hexadecimal ASCII code for the space character. You will also see + used for spaces, but only in form submissions (application/x-www-form-urlencoded); in a URL path or a properly encoded query string, space is always %20.
How do I decode a URL?
Paste it into the Encoded box on this page and the readable text appears instantly — each %XX triplet is converted back to its character. In JavaScript, decodeURIComponent reverses component encoding and decodeURI reverses full-URL encoding; both are built into every browser.
Why is my URL double-encoded?
Because it was encoded twice: the % of the first pass got encoded again into %25, so %20 became %2520. It happens when data passes through two layers that each encode defensively. The fix is to decode once (giving back the single-encoded form) and then make sure only one layer encodes from then on.

Related Tools