URL Encode/Decode
Percent-encode or decode URLs and query string parameters.
Plain Text
Encode →← Decode
URL Encoded
What is URL Encoding?
URL encoding (percent-encoding) replaces unsafe characters with % followed by two hex digits. Defined in RFC 3986. Required because URLs can only contain ASCII characters, and certain characters like &, =, ?, / have special meaning. For example, a space becomes %20 and & becomes %26.
Characters That Need Encoding
Space → %20 (or +), & → %26, = → %3D, ? → %3F, # → %23, / → %2F, + → %2B, @ → %40, : → %3A. Note: encodeURIComponent() encodes everything except A-Z a-z 0-9 - _ . ~ ! * ' ( )
// JavaScript
encodeURIComponent("hello world&foo=bar")
// "hello%20world%26foo%3Dbar"
decodeURIComponent("hello%20world%26foo%3Dbar")
// "hello world&foo=bar"
// Python
from urllib.parse import quote, unquote
quote("hello world&foo=bar")encodeURI vs encodeURIComponent
encodeURI encodes a full URL but preserves :/?#[]@!$&'()*+,;= since they're valid in URLs. encodeURIComponent encodes everything except unreserved chars — use it for query parameter values. Common mistake: using encodeURI for query params leaves & and = unencoded.
Percent-Encoding Reference Table
Common characters and their percent-encoded values. encodeURIComponent() encodes all of these; unreserved characters (A-Z a-z 0-9 - _ . ~) are never encoded.
| Character | Name | Encoded |
|---|---|---|
| (space) | Space | %20 (or +) |
| ! | Exclamation | %21 |
| " | Quote | %22 |
| # | Hash / fragment | %23 |
| $ | Dollar | %24 |
| % | Percent | %25 |
| & | Ampersand | %26 |
| ' | Apostrophe | %27 |
| ( | Open paren | %28 |
| ) | Close paren | %29 |
| * | Asterisk | %2A |
| + | Plus | %2B |
| , | Comma | %2C |
| / | Slash | %2F |
| : | Colon | %3A |
| ; | Semicolon | %3B |
| = | Equals | %3D |
| ? | Question mark | %3F |
| @ | At sign | %40 |
| [ | Open bracket | %5B |
| ] | Close bracket | %5D |
Frequently Asked Questions
- What's the difference between %20 and + for spaces?
- Both represent spaces but in different contexts. %20 is used in URL paths (RFC 3986). + is used in query strings (application/x-www-form-urlencoded, from HTML forms). Most servers accept both, but %20 is more universal.
- Do I need to encode the entire URL?
- No. Only encode the parts that might contain special characters — typically query parameter values and path segments. The structure characters (:, /, ?, &, =) should remain unencoded for the URL to work.
- Why are my API requests failing with special characters?
- You probably need to URL-encode your query parameters. Characters like &, =, and # have special meaning in URLs. Use encodeURIComponent() on each parameter value before building the URL.
Guides
Related Tools
Base64 Encode/Decode
Encode text to Base64 or decode Base64 to text instantly.
JWT DecoderDecode and inspect JSON Web Tokens without sending them to a server.
JSON Formatter & ValidatorFormat, validate, and minify JSON with syntax highlighting.
HTML Entity Encoder/DecoderEncode special characters to HTML entities or decode them back.