Encode a query value
hello world & more
hello%20world%20%26%20more
The & must become %26, otherwise it would start a new query parameter.
Percent-encode text and URLs, or decode them back, even when they were encoded two, three or more times. See every decoding step and every query parameter, decoded.
Decoding steps
Encoded characters
URL breakdown
| Parameter | Value (decoded) |
|---|
+), or Full URL to keep : / ? & = intact. Set Times to encode twice or more.hello world & more
hello%20world%20%26%20more
The & must become %26, otherwise it would start a new query parameter.
hello world & more
hello+world+%26+more
This is the application/x-www-form-urlencoded format that browsers use when they submit a form.
a b
a%2520b
The first pass gives a%20b; the second pass encodes the % itself as %25.
caf%2525C3%2525A9
café
The decoding steps show caf%25C3%25A9, then caf%C3%A9, then café: the value was encoded three times.
https://dev247.net/search?q=café & tea
https://dev247.net/search?q=caf%C3%A9%20&%20tea
Full URL mode keeps the &, so the server now sees a broken parameter. Encode each value with Component instead.
URL encoding, also called percent-encoding, replaces characters that are not allowed or have a special meaning in a URL with a % sign followed by two hex digits. A space becomes %20, an ampersand becomes %26, and non-English characters are first turned into UTF-8 bytes, so é becomes %C3%A9. Browsers, servers and APIs decode these sequences back into the original text. The rules are defined in RFC 3986.
URL encoding is not encryption. It only makes text safe to put in a URL, and anyone can decode it.
RFC 3986 splits characters into three groups:
| Group | Characters | Rule |
|---|---|---|
| Unreserved | A–Z a–z 0–9 - . _ ~ | Never need encoding |
| Reserved | : / ? # [ ] @ ! $ & ' ( ) * + , ; = | Have a meaning in URLs; encode them when they are part of a value |
| Everything else | Spaces, " % < > \ ^ ` { | }, line breaks, non-ASCII characters | Always encoded |
The most common percent codes:
| Char | Code | Char | Code | Char | Code |
|---|---|---|---|---|---|
| space | %20 | & | %26 | / | %2F |
| ! | %21 | ' | %27 | : | %3A |
| " | %22 | ( | %28 | ; | %3B |
| # | %23 | ) | %29 | = | %3D |
| $ | %24 | * | %2A | ? | %3F |
| % | %25 | + | %2B | @ | %40 |
The biggest source of URL bugs is using the wrong function. They encode different sets of characters:
| Function | Leaves unencoded | Space | Use it for |
|---|---|---|---|
encodeURIComponent | A–Z a–z 0–9 - _ . ! ~ * ' ( ) | %20 | One query value or one path segment |
| RFC 3986 strict | A–Z a–z 0–9 - _ . ~ | %20 | OAuth signatures, AWS signing, strict APIs |
Form (URLSearchParams) | A–Z a–z 0–9 - _ . * | + | HTML form bodies and query strings |
encodeURI | Unreserved + all reserved characters | %20 | A complete URL that is already structured |
Rule of thumb: build the URL from parts and encode each value with encodeURIComponent (or URLSearchParams). encodeURI leaves &, = and # alone, so a value like tea & cake would break the query string.
Both, depending on where. In a query string produced by an HTML form, a space is written as + (the application/x-www-form-urlencoded format). Everywhere else, including the path, a space is %20, and a literal + is just a plus sign. That is why C++ in a search box must be sent as C%2B%2B: otherwise the server reads it as C followed by two spaces. The + means space option controls how this tool treats + when decoding.
Double encoding happens when text that is already encoded gets encoded again. The % sign itself becomes %25, so a space turns into %2520 instead of %20:
| Passes | a b becomes |
|---|---|
| 1 | a%20b |
| 2 | a%2520b |
| 3 | a%252520b |
How to spot it: look for %25 followed by two hex digits, such as %2520, %253A or %252F. This tool's decoder counts the layers for you.
Common causes: encoding a value and then passing it to a library that encodes it again (for example URLSearchParams, Laravel's route() or Axios params), redirect chains where each hop encodes the target URL, and copying an already-encoded URL into a form field.
Sometimes double encoding is intentional, for example when a full URL is passed as a parameter inside another URL that is itself encoded. In that case, decode exactly as many times as it was encoded.
Double encoding and security. Attackers use double encoding to sneak characters such as ../ or <script> past filters that only decode once (for example %252e%252e%252f). Validate input after decoding it fully, and decode exactly once in your application.
URLs can only carry ASCII, so other characters are converted to UTF-8 bytes first, and each byte is percent-encoded:
é → bytes C3 A9 → %C3%A9☕ → bytes E2 98 95 → %E2%98%95😀 → bytes F0 9F 98 80 → %F0%9F%98%80Old systems sometimes used Latin-1 instead, where é is the single byte %E9. Decoding that as UTF-8 fails, which is why this tool offers a Latin-1 / Windows-1252 charset.
encodeURIComponent('a b&c'); // "a%20b%26c"encodeURI('https://x.com/a b?q=1&r=2'); // "https://x.com/a%20b?q=1&r=2"new URLSearchParams({ q: 'a b&c' }).toString(); // "q=a+b%26c" decodeURIComponent('a%20b%26c'); // "a b&c" // Build URLs safelyconst url = new URL('https://dev247.net/search');url.searchParams.set('q', 'café & tea');url.toString(); // "https://dev247.net/search?q=caf%C3%A9+%26+tea"urlencode('a b&c'); // "a+b%26c" (form style)rawurlencode('a b&c'); // "a%20b%26c" (RFC 3986)http_build_query(['q' => 'a b&c']); // "q=a+b%26c" urldecode('a+b%26c'); // "a b&c"rawurldecode('a+b'); // "a+b" (plus stays a plus)from urllib.parse import quote, quote_plus, unquote_plus, urlencode quote('a b&c', safe='') # 'a%20b%26c' (safe='/' by default!)quote_plus('a b&c') # 'a+b%26c'urlencode({'q': 'a b&c'}) # 'q=a+b%26c'unquote_plus('a+b%26c') # 'a b&c'curl -G 'https://example.com/search' --data-urlencode 'q=a b&c'# requests https://example.com/search?q=a%20b%26cURIError: URI malformed (decodeURIComponent)
The input has a % that is not followed by two hex digits, or bytes that are not valid UTF-8 (often Latin-1 data such as %E9). This tool does not crash on these: it decodes what it can, leaves the rest and tells you. Try the Latin-1 charset for old data.
URLs contain %2520, %253A or %252F
The value was encoded twice. Decode it here to see how many layers it has, then find the place in your code that encodes an already-encoded value (often a library that encodes parameters for you) and remove one of the encode calls.
A + in the data turns into a space (or spaces turn into +)
One side uses form encoding and the other uses RFC 3986. In query strings, encode a literal plus as %2B. In PHP, use rawurlencode/rawurldecode when you do not want form behaviour.
A query value is cut off at &, # or =
The value was not encoded, or it was encoded with encodeURI, which leaves those characters alone. Encode each value with encodeURIComponent or URLSearchParams.
A URL with %2F in the path returns 404
Many servers reject or decode encoded slashes in the path for security reasons (Apache needs AllowEncodedSlashes). Avoid putting slashes in path segments: pass such values in the query string instead.
encodeURI encodes a whole URL and leaves characters like : / ? & = # untouched so the URL keeps its structure. encodeURIComponent encodes those characters too, so it is the right choice for a single query value or path segment.
In query strings sent by HTML forms, + is used. Everywhere else, including URL paths, use %20. When in doubt, %20 is always understood as a space, while + is only a space in form-encoded query strings.
Look for %25 followed by two hex digits, such as %2520 (an encoded %20). Paste the value here in Decode mode: the tool shows how many times it was encoded and every intermediate step.
The unreserved characters: A–Z, a–z, 0–9, -, ., _ and ~. Everything else is either reserved (with a meaning in URLs) or must always be encoded.
Yes. Each character is converted to its UTF-8 bytes, and each byte is encoded, so é becomes %C3%A9 and 😀 becomes %F0%9F%98%80.
No. Encoding, decoding and the URL breakdown all run in your browser, so you can safely paste URLs that contain tokens or personal data.
Free, private developer tools that run in your browser. No signup, nothing uploaded, no waiting.
Tip: press Ctrl D to bookmark dev247.