URL Encoder / Decoder
Encode text for URLs or decode URL-encoded strings. Batch process multiple lines, supports RFC 3986, with conversion table and character details.
How URL Encoding Works
URL encoding (percent-encoding) converts unsafe ASCII characters into a % followed by two hex digits.
Percent-Encoding
- Safe characters — A-Z, a-z, 0-9, and some specials (-, _, ., ~) are left as-is.
- Reserved characters — Characters like :, /, ?, #, [, ], @ have special meanings in URLs.
- Unsafe characters — Spaces, quotes, non-ASCII characters, and control characters are encoded.
- UTF-8 encoding — Non-ASCII characters are first encoded as UTF-8 bytes, then each byte is percent-encoded.
- RFC 3986 — The modern standard for URI syntax and percent-encoding rules.
Frequently Asked Questions
Common questions about URL encoding and decoding.
encodeURI encodes a complete URI but preserves characters that are part of the URI syntax (:/?#[]@). encodeURIComponent encodes everything, including those characters, making it suitable for encoding query parameter values. For example, encodeURI('?a=1&b=2') keeps ?&= intact, while encodeURIComponent encodes them.
In URL query strings, a space can be encoded as + (application/x-www-form-urlencoded) or %20 (percent-encoding). The + comes from early URL encoding standards. For URI path segments, spaces must be encoded as %20. Most modern systems accept both, but %20 is the strictly correct form.
Characters that must be encoded include: spaces, control characters, non-ASCII characters, and reserved characters when used outside their allowed context. This includes: < > " { } | \ ^ ~ ` % (when not part of encoding) and # ? [ ] @ : / = & ; , in certain positions.
Unicode characters (like é or 中国) are first encoded as UTF-8 bytes, then each byte is percent-encoded. For example, é (U+00E9) becomes %C3%A9. The resulting encoded string is ASCII-safe and can be transmitted over any text-based protocol.