Good to know
What percent-encoding does
RFC 3986 lets a URL use only a limited set of characters. Everything else is turned into UTF-8 bytes, and each byte is written as % followed by two hexadecimal digits.
- Always safe, never encoded:
A–Z a–z 0–9 - . _ ~ - Reserved, with a job inside URLs:
: / ? # [ ] @ ! $ & ’ ( ) * + , ; =
Worked examples
| Input | Mode | Output |
|---|---|---|
| fish & chips | Component | fish%20%26%20chips |
| fish & chips | Form data | fish+%26+chips |
| café | Component | caf%C3%A9 |
| 👋 | Component | %F0%9F%91%8B |
The é takes two bytes in UTF-8, so it becomes two codes. The emoji takes four.
Choosing the mode
Component encodes reserved characters too. Use it for a single value you are placing after ?q=, because an unencoded & there would start a new parameter. Whole URL leaves : / ? & = # alone, so https://example.com/a b?x=1 becomes https://example.com/a%20b?x=1 and still works. Form data follows the application/x-www-form-urlencoded format that web forms send, where a space is +; decoding in this mode turns + back into spaces.
When decoding fails
Every % must be followed by two hex digits, and the bytes must form valid UTF-8. A lone %, or %C3 without its second byte, cannot be decoded, and the tool says so instead of guessing. Encoding twice is a common slip: %20 encoded again becomes %2520.