Quick answer
URL encoding (percent-encoding, RFC 3986) replaces every unsafe character with its UTF-8 bytes written as %XX: a space becomes %20 and “é” becomes %C3%A9, so “café au lait” becomes caf%C3%A9%20au%20lait. Use “URL component” (encodeURIComponent) for parameter values and “Whole URL” (encodeURI) when / ? & # must stay intact.
What is URL encoding?
This tool percent-encodes and decodes URLs in any language using UTF-8, points to the exact position of a broken % sequence instead of a bare “URI malformed”, splits a long URL into scheme, host, path, decoded query parameters and fragment so you can edit and rebuild it, and converts international domain names to Punycode (xn--…) for DNS records. Everything runs in your browser.

How to encode and decode URLs
- 1
On “Encode / decode”, pick Encode or Decode and type or paste your text; the result appears next to it straight away.
- 2
When encoding, choose “URL component” for parameter values and path segments, or “Whole URL” for a complete address. When decoding form data, turn on “Treat + as a space”.
- 3
On “Parse URL”, paste an address to see every part; edit, add or remove query parameters, then copy the rebuilt URL.
- 4
On “International domains”, enter a domain with accents or non-Latin script (or its xn-- form) to get both the ASCII and Unicode versions.
encodeURIComponent vs encodeURI
| Character | URL component (encodeURIComponent) | Whole URL (encodeURI) | Why |
|---|---|---|---|
| Space | %20 | %20 | URLs can't contain spaces |
| é, ü, ñ, 中 | %C3%A9, %C3%BC, %C3%B1, %E4%B8%AD | Same as left | Non-ASCII characters take 2–4 UTF-8 bytes |
| / ? # @ | %2F %3F %23 %40 | Kept | They delimit the parts of a URL (gen-delims); [ ] are still encoded as %5B %5D |
| & = + $ , ; : | %26 %3D %2B %24 %2C %3B %3A | Kept | Secondary delimiters (sub-delims) |
| A–Z a–z 0–9 - _ . ! ~ * ' ( ) | Kept | Kept | Never need encoding |
Swipe sideways to see the whole table →
Running a whole URL through encodeURIComponent turns https:// into https%3A%2F%2F and the link stops working.
Anatomy of a URL
Example: https://user:pass@bücher.de:8443/neue-bücher/a?q=café+au+lait&page=2#top
| Part | Value in the example | Notes |
|---|---|---|
| Scheme | https | Ends with “:” |
| User info | user:pass | Rarely used; browsers warn about it |
| Host | xn--bcher-kva.de | International domains are converted to Punycode |
| Port | 8443 | Blank means 443 (https) or 80 (http) |
| Path | /neue-bücher/a | Sent as /neue-b%C3%BCcher/a |
| Query | q = café au lait, page = 2 | In a query string, + means a space |
| Fragment | top | Never sent to the server; used by the browser only |
Real-world examples
Putting a search phrase into a link
For https://example.com/search?q=running shoes, encode just “running shoes” as a URL component to get running%20shoes and append it after q=. If the phrase contains & (say “Salt & Pepper”), it must become %26 or everything after it turns into a new parameter.
Reading a long UTM link
Campaign links such as ?utm_source=newsletter&utm_campaign=Spring%20Sale%20%E2%80%93%2030%25 are hard to read. Paste it into “Parse URL” to see decoded parameters, fix utm_campaign and copy the new URL.
Registering an international domain
Bought “bücher.de” but your DNS host or certificate authority only accepts plain ASCII? “International domains” gives you xn--bcher-kva.de to use in the records.
Fixing “URI malformed”
Decoding “50%off” fails at position 3 because % isn't followed by two hex digits. If it is a real percent sign, the correct encoding is 50%25off.
Common problems and fixes
- The link no longer opens after encoding.
- You encoded the whole address as a URL component, so :// and / were encoded too. Choose “Whole URL”, or encode only the parameter values.
- There's still %20 or %25 after decoding.
- The text was encoded twice (%2520 is %20 encoded again). Click Swap and decode once more.
- A + turned into a space, or the other way round.
- In form data and query strings + means a space; in the path it is a literal +. Toggle “Treat + as a space” to match where the data came from.
- Decoding produces gibberish like “é”.
- The text was encoded with a legacy character set (such as Windows-1252) or was already decoded wrongly once. This tool uses UTF-8, which every modern browser uses.
- “Not a valid UTF-8 character”.
- A %XX sequence was cut short (for example %C3 without its second byte). Copy the original link again in full.
Why URLs need encoding
A URL may only contain a limited set of ASCII characters. Accented letters, spaces, quotes and characters with a structural meaning such as & ? # have to be written as %XX, where XX is the hex value of each UTF-8 byte. Your address bar shows readable characters, but what actually goes over the network is the encoded form.
Encoding in the right place keeps parameters intact: an unencoded value like “Salt & Pepper” splits into a parameter “Salt ” and an empty one called “ Pepper”.
Punycode and international domains
The domain name system only accepts unaccented Latin letters, digits and hyphens. Internationalized domain names are converted to Punycode as defined in RFC 3492: each non-ASCII label becomes xn--…, so bücher.de becomes xn--bcher-kva.de. Browsers convert back and forth automatically; you only need the xn-- form for DNS records, web server configuration and SSL certificates.
Glossary
- Percent-encoding
- Writing a byte as %XX (two hex digits), as specified in RFC 3986.
- Query string
- The part of a URL after ?, made of name=value pairs joined by &.
- Fragment
- The part after #, used only by the browser to jump to a spot on the page.
- IDN
- Internationalized Domain Name: a domain containing characters beyond plain Latin letters.
- Punycode
- An ASCII representation of Unicode used for domain names, prefixed with xn--.
- UTF-8
- A character encoding using 1–4 bytes per character; accented Latin letters usually take 2.
Frequently asked questions
Should I use encodeURIComponent or encodeURI?
Use encodeURIComponent (“URL component”) for each value you insert into a URL, such as parameters and path segments. Use encodeURI (“Whole URL”) only on a complete URL when you just want to escape spaces and non-ASCII characters.
Why does “café” become caf%C3%A9?
“é” takes two bytes in UTF-8, and each byte is written as three characters %XX. A space is %20.
What does + mean in a URL?
In an HTML-form style query string, + means a space. In the path it is a literal plus sign. To be sure you get a real +, encode it as %2B.
Is my URL sent anywhere?
No. Encoding, decoding, parsing and Punycode conversion all run in JavaScript in your browser, even for URLs that contain tokens or credentials.
Is URL encoding a form of encryption?
No. It only rewrites characters so the URL is valid, and anyone can decode it. Don't use it to hide passwords or sensitive data.
Does parsing keep order and repeated parameters?
Yes. Parameters keep their order and repeated names (such as page=2&page=3) show as separate rows; rows with an empty name are dropped when the URL is rebuilt.
Ratings and comments
Loading…