Skip to content

↑↓ navigate ↵ open Esc close Search runs locally

URL Encode & Decode Online (Double Encoding Too)

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.

  • Runs in your browser
  • Nothing is uploaded
  • Free, no sign-up
0 charsUTF-8
Encoded
Runs in your browser. Nothing is uploaded. Tip: paste a whole URL to see its parts

How to use the URL Encode / Decode tool#

  1. Choose Encode or Decode at the top of the tool.
  2. To encode, pick a Format: Component for a single query value or path part, RFC 3986 strict, Form (spaces become +), or Full URL to keep : / ? & = intact. Set Times to encode twice or more.
  3. To decode, paste the encoded text or the whole URL. With Layers: All, the tool keeps decoding until nothing encoded is left and shows every step.
  4. Check the URL breakdown under the tool: each query parameter is listed with its decoded value, and values that are still encoded are flagged.

Examples#

Encode a query value

Input
hello world & more
Output
hello%20world%20%26%20more

The & must become %26, otherwise it would start a new query parameter.

Encode for an HTML form (spaces as +)

Input
hello world & more
Output
hello+world+%26+more

This is the application/x-www-form-urlencoded format that browsers use when they submit a form.

Double-encode a value

Input
a b
Output
a%2520b

The first pass gives a%20b; the second pass encodes the % itself as %25.

Decode a triple-encoded value

Input
caf%2525C3%2525A9
Output
café

The decoding steps show caf%25C3%25A9, then caf%C3%A9, then café: the value was encoded three times.

Encode a full URL

Input
https://dev247.net/search?q=café & tea
Output
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.

What is URL encoding?#

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.

Which characters are encoded?#

RFC 3986 splits characters into three groups:

GroupCharactersRule
UnreservedA–Z a–z 0–9 - . _ ~Never need encoding
Reserved: / ? # [ ] @ ! $ & ' ( ) * + , ; =Have a meaning in URLs; encode them when they are part of a value
Everything elseSpaces, " % < > \ ^ ` { | }, line breaks, non-ASCII charactersAlways encoded

The most common percent codes:

CharCodeCharCodeCharCode
space%20&%26/%2F
!%21'%27:%3A
"%22(%28;%3B
#%23)%29=%3D
$%24*%2A?%3F
%%25+%2B@%40

encodeURI vs encodeURIComponent vs form encoding#

The biggest source of URL bugs is using the wrong function. They encode different sets of characters:

FunctionLeaves unencodedSpaceUse it for
encodeURIComponentA–Z a–z 0–9 - _ . ! ~ * ' ( )%20One query value or one path segment
RFC 3986 strictA–Z a–z 0–9 - _ . ~%20OAuth signatures, AWS signing, strict APIs
Form (URLSearchParams)A–Z a–z 0–9 - _ . *+HTML form bodies and query strings
encodeURIUnreserved + all reserved characters%20A 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.

%20 or +: which one is a space?#

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: what it is and how to spot it#

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:

Passesa b becomes
1a%20b
2a%2520b
3a%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.

URL encoding and Unicode#

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%80

Old 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.

URL encoding in code#

JavaScript#

javascript
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"

PHP#

php
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)

Python#

python
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#

bash
curl -G 'https://example.com/search' --data-urlencode 'q=a b&c'# requests https://example.com/search?q=a%20b%26c

Common errors and fixes#

  • URIError: 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.

Frequently asked questions#

What is the difference between encodeURI and encodeURIComponent?

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.

Should a space be %20 or +?

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.

How do I know if a URL is double encoded?

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.

Which characters never need to be URL-encoded?

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.

Does URL encoding work with emoji and other languages?

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.

Is my data sent to a server?

No. Encoding, decoding and the URL breakdown all run in your browser, so you can safely paste URLs that contain tokens or personal data.

Your next tool is one search away.

Free, private developer tools that run in your browser. No signup, nothing uploaded, no waiting.

Browse all tools

Tip: press Ctrl D to bookmark dev247.