How to use the URL Encode / Decode
- Pick a mode: Encode component for a single query value or path segment, Encode full URL for a complete address, or Decode.
- Type or paste into the left box; the result updates as you type.
- Use Spaces as + for HTML-form style encoding, or Each line separately to process a list.
- Paste any URL into the URL parser to see its host, path, and a decoded table of query parameters.
What is URL encoding?
URL encoding, formally percent-encoding (RFC 3986), replaces characters that are not allowed or have a special meaning in a URL with a % followed by two hexadecimal digits. A space becomes %20, & becomes %26, and non-ASCII characters are first converted to UTF-8 bytes and then encoded byte by byte: é → %C3%A9, € → %E2%82%AC. Without encoding, a value like Tom & Jerry in a query string would be split into two parameters.
encodeURIComponent vs. encodeURI
JavaScript offers two functions, and picking the wrong one is a classic bug:
| Character | encodeURIComponent | encodeURI |
|---|---|---|
| Space | %20 | %20 |
/ ? # & = : @ + , ; $ | Encoded | Kept as is |
A–Z a–z 0–9 - _ . ! ~ * ' ( ) | Kept | Kept |
é, emoji, other non-ASCII | UTF-8 percent-encoded | UTF-8 percent-encoded |
Use encodeURIComponent (“Encode component”) for anything you insert into a URL — a query parameter value, a path segment, a redirect URL passed as a parameter. Use encodeURI (“Encode full URL”) only on a complete URL that just contains spaces or non-ASCII characters, because it leaves the structural characters : / ? # & intact.
%20 or +?
In the path of a URL a space must be %20. In query strings submitted by HTML forms (application/x-www-form-urlencoded) spaces are written as +. Most servers accept both in the query string, but a literal plus sign must then be sent as %2B. The decoder treats + as a space by default; untick the option if your data contains real plus signs.
Decoding errors
A % must be followed by exactly two hex digits, and multi-byte UTF-8 characters need all their bytes. Plain decodeURIComponent() throws URIError: malformed URI sequence on the first bad sequence; this tool decodes everything that is valid, leaves malformed parts untouched and tells you which ones they are. Double-encoded strings (%2520) show up as %20 after one pass — decode again to get the space.
Anatomy of a URL
https://user@shop.example.com:8443/search?q=shoes#results consists of the scheme (https:), optional credentials, host, port, path, query string and fragment. The parser above uses the browser's standard URL API (WHATWG URL Standard), the same one used by fetch(). Building campaign links? Try the UTM Builder. Need to encode binary data instead? Use Base64.
Tools that pair well with the URL Encode / Decode
- HTML Entity Encoder — Escape < > & " so text is safe to show in HTML, convert accents and symbols to named or numeric entities, or decode entity-filled HTML back to plain text.
- Slug Generator — Convert any title into a clean, lowercase URL slug — with proper transliteration of accents, umlauts and Cyrillic, optional stop-word removal and a bulk mode for whole lists.
- JWT Decoder — Paste a JSON Web Token to inspect its header and payload, check when it expires and verify its signature.
- Hash Generator — Compute MD5 and SHA hashes of any text or file instantly, create HMAC signatures, and paste an expected checksum to verify a download.
Frequently asked questions
When should I use encodeURIComponent instead of encodeURI?
/ ? & # = unencoded.Why is a space sometimes %20 and sometimes +?
%20 is the RFC 3986 encoding valid everywhere in a URL. + means space only in form-encoded query strings (application/x-www-form-urlencoded), which is what HTML forms send.What does “URIError: malformed URI sequence” mean?
% not followed by two hex digits, or an incomplete UTF-8 byte sequence. This decoder leaves those parts unchanged and lists them, instead of failing.Which characters never need encoding?
A–Z a–z, digits 0–9 and - _ . ~. Everything else is either reserved for URL syntax or must be percent-encoded.