How URL encoding works
A URL can only contain a limited set of characters. Letters, digits and a handful of symbols are allowed directly; everything else — spaces, accented letters, and characters that have a special meaning in a web address — must be percent-encoded. Each disallowed byte is written as a percent sign followed by its two-digit hexadecimal value, so a space becomes %20 and an ampersand becomes %26.
The reason matters: characters like &, ? and = are structural in a URL — they separate the query string and split it into key/value pairs. If a value legitimately contains one of them, it must be encoded so the browser does not mistake it for structure. That is the difference between encodeURIComponent, which escapes those characters because it is meant for a single value, and encodeURI, which leaves them alone because it is meant for a whole URL.
name=John & Jane encoded with encodeURIComponent becomes name%3DJohn%20%26%20Jane. Decoding it with decodeURIComponent returns the original name=John & Jane. Encoding the same text with encodeURI instead gives name=John%20&%20Jane — the = and & stay intact because they are treated as URL structure.| Character | Name | Percent-encoding |
|---|---|---|
| (space) | Space | %20 |
| & | Ampersand | %26 |
| ? | Question mark | %3F |
| # | Hash / fragment | %23 |
| / | Slash | %2F |
| = | Equals | %3D |
Reference note: encoding and decoding use the browser's built-in encodeURIComponent, encodeURI, decodeURIComponent and URL functions, which follow the UTF-8 percent-encoding rules of the URL standard.
Frequently asked questions
- What is URL encoding?
- URL encoding, also called percent-encoding, replaces characters that are unsafe or reserved in a URL with a percent sign and two hexadecimal digits — a space becomes %20 and an ampersand becomes %26 — so arbitrary text can sit safely inside a web address.
- What is %20 / why are there percent signs in URLs?
- A percent sign introduces an encoded byte. %20 is the encoded form of a space, since spaces are not allowed in URLs. The two characters after it are the hexadecimal value of the byte, so %26 is an ampersand and %3F is a question mark.
- What's the difference between encodeURI and encodeURIComponent?
- encodeURIComponent encodes a single value and escapes reserved characters like & ? = and /. encodeURI is for a whole URL and leaves those structural characters intact so the address still works. Use component for pieces and URI for complete URLs.
- How do I decode a URL?
- Set the mode to Decode and paste the encoded string. The tool runs decodeURIComponent, turning %20 back into spaces and %26 back into ampersands. A malformed percent sequence makes decoding fail, and the tool reports the error.
- How do I read the query parameters of a URL?
- Paste the full URL into the URL parser. It uses the browser's built-in URL API to split the address into protocol, hostname, port and pathname, and lists each query parameter as a decoded key and value.
- Is my data uploaded?
- No. All encoding, decoding and parsing happen entirely in your browser. Nothing you paste is sent to a server or stored anywhere — it is local only.