What characters need URL encoding?
RFC 3986 divides URL characters into three buckets:
- Unreserved — letters (A-Z, a-z), digits (0-9), and
- . _ ~. Never encoded. - Reserved — have special meaning in URLs:
: / ? # [ ] @ ! $ & ' ( ) * + , ; =. Encoded when they appear in the "wrong" place (e.g. a?inside a query value). - Everything else — spaces, Unicode, control characters. Always encoded.
Common escapes:
| Character | Encoded | Why |
|---|---|---|
| Space | %20 or + | + only in query strings, %20 everywhere |
/ | %2F | Path separator — encode when in value |
? | %3F | Starts query string |
# | %23 | Starts fragment |
& | %26 | Separates query params |
= | %3D | Assigns query values |
@ | %40 | Used in userinfo (user@host) |
| Unicode (emoji, CJK) | UTF-8 bytes → percent-encode each byte | 😀 → %F0%9F%98%80 |
encodeURI vs encodeURIComponent — and why you usually want the second
JavaScript has two URL-encoding functions with a crucial difference:
// encodeURI — leaves reserved chars alone (encodes for "a whole URL")
encodeURI("https://example.com/path with spaces?a=1&b=2")
// "https://example.com/path%20with%20spaces?a=1&b=2"
// ↑ colons, slashes, ?, & all preserved
// encodeURIComponent — encodes reserved chars (encodes for "a single query value")
encodeURIComponent("a=1&b=2")
// "a%3D1%26b%3D2"
// ↑ = and & encoded
Rule: use encodeURIComponent for each query parameter value, never encodeURI on them. Using encodeURI on a query value means = and & inside the value will break the URL structure.
// ✗ WRONG — breaks if comment contains = or &
url += "?comment=" + encodeURI(userComment);
// ✓ RIGHT
url += "?comment=" + encodeURIComponent(userComment);
Python equivalents: urllib.parse.quote() (like encodeURI, leaves /) vs urllib.parse.quote_plus() (like encodeURIComponent, replaces space with +).
Frequently Asked Questions
How do I URL encode special characters online?
Paste any text or URL into the encoder. Characters outside the unreserved set (letters, digits, `-._~`) become percent-encoded (`%20` for space, `%2F` for slash, `%3A` for colon, etc.). Essential for query strings, form data and HTTP headers.
What's the difference between URL encoding and URI encoding?
`encodeURIComponent` (stronger) escapes reserved characters like `?`, `#`, `&`, `=`, `/` — use for single query parameter values. `encodeURI` (softer) leaves those as-is — use for a full URL. Our tool supports both modes.
How do I decode a URL-encoded string?
Paste the percent-encoded string into the decoder. It converts `%20` back to space, `%2B` to `+`, `%26` to `&`, etc. Also handles double-encoded URLs (percent signs inside percent signs) with a one-click double-decode option.
Does this URL encoder handle Unicode and emoji?
Yes. Non-ASCII characters (Chinese, Arabic, emoji) are UTF-8 encoded then percent-escaped per RFC 3986. So 😀 becomes `%F0%9F%98%80`. Decoding reverses the process exactly.
Is my URL data private?
Yes. All encoding and decoding runs in your browser — nothing is sent to any server. Safe for URLs containing auth tokens, session IDs or customer data.
Related Developer Tools
Copyright © 2026 BuildStudio. All rights reserved.
Designed and Developed by Webority Technologies