What is URL encoding?
URLs may only contain a limited set of characters. Spaces, accented letters, emoji and characters with special meaning in a URL, such as &, ?, # and /, have to be written in a safe form called percent-encoding. Each byte of the character's UTF-8 representation is written as % followed by two hexadecimal digits: a space becomes %20 and é becomes %C3%A9.
Getting this wrong is a common source of bugs: a search term containing & splits a query string in two, and an unencoded # cuts the rest of a URL off. This tool encodes and decodes correctly, and breaks a URL into its parts so you can see exactly what a server will receive.
How to use it
- Choose Encode or Decode.
- Pick Component to encode a single value, such as a query parameter, or Full URL to encode a whole address while keeping its structure.
- Tick Spaces as + for HTML form-style encoding (application/x-www-form-urlencoded).
- Paste your text. The output and, for full URLs, a table of every part and query parameter appear instantly.
Component vs full URL encoding
| Character | Component | Full URL |
|---|---|---|
| space | %20 | %20 |
/ | %2F | / (kept) |
? & = | %3F %26 %3D | kept |
| é | %C3%A9 | %C3%A9 |
Use component encoding for anything you insert into a URL, like a search term or file name. Use full URL encoding only to clean up an address that is already structured correctly.
Example
To build https://example.com/search?q= with the search term “café & crème”, encode the term as a component: caf%C3%A9%20%26%20cr%C3%A8me. Without encoding, the & would start a new, empty parameter and the search would only receive “café ”.
More worked examples
Search link: the term “50% off & free shipping” must be encoded as 50%25%20off%20%26%20free%20shipping inside a query string, or the & would start a new parameter.
Common mistakes to avoid
- Encoding a whole URL as a component. That also encodes : and /, breaking the address.
- Double encoding. %20 becomes %2520; decode first if unsure.
- Using percent-encoding for page slugs. Make readable slugs with the text to slug converter instead.
Sources and methodology
The calculations on this page follow these published standards and references. The code is covered by automated tests against known values.