Skip to content

URL encoder and decoder: percent-encode query strings and URLs

URL encoding (percent-encoding) replaces characters that are not allowed in a URL with a percent sign followed by their two-digit hexadecimal byte value, so a space becomes %20 and & becomes %26. It is required for query-string values and path segments that contain spaces, punctuation or non-ASCII text. Decoding reverses the process. This tool encodes either a full URL (preserving :/?#& structure) or a single component (encoding everything), and decodes both, locally in your browser.

C5URL encode / decode — ToolsBoxx
Ready0 B sent to server

Your files never leave your device. Processing happens in your browser.How that works.

How it works

  1. Paste a URL or text.
  2. Choose Component (encode everything) or Full URL (keep structure), then Encode or Decode.
  3. Copy the result.

Runs as JavaScript inside this tab. Turn off your connection after the page loads and it still works.

Percent-encoding reference

Which characters need encoding

RFC 3986 divides characters into three groups.

Group Characters Treatment
Unreserved A–Z a–z 0–9 - _ . ~ Never encoded
Reserved : / ? # [ ] @ ! $ & ' ( ) * + , ; = Encoded when used as data, left alone when used as URL structure
Everything else space, `” < > \ ^ { } %`, control characters, non-ASCII

Non-ASCII characters are first converted to UTF-8 bytes and each byte is percent-encoded: é → %C3%A9, € → %E2%82%AC, 😀 → %F0%9F%98%80.

Encoding table

Char Encoded Char Encoded Char Encoded
space %20 & %26 ? %3F
! %21 ' %27 @ %40
" %22 ( %28 [ %5B
# %23 ) %29 ] %5D
$ %24 * %2A { %7B
% %25 + %2B } %7D
, %2C / %2F | %7C
: %3A ; %3B \ %5C
< %3C = %3D ^ %5E
> %3E ` %60 ~ not encoded

The three modes

Mode JavaScript Encodes Use for
Component encodeURIComponent (plus !'()*) everything reserved A single query value, path segment or header value
Full URL encodeURI only unsafe characters; keeps :/?#&=+$,;@ A complete address typed by a person
Form data component, then %20 → + as component application/x-www-form-urlencoded bodies and legacy query strings

Common pitfalls

  • Double encoding. Encoding an already-encoded string turns %20 into %2520. The decoder here reports how many layers it detects.
  • + versus %20. In a path, + is a literal plus sign. In a form-encoded query string, + means space. Servers differ; %20 is safe everywhere.
  • Encoding the whole URL as a component. https%3A%2F%2F… is what you get when a full URL is passed to encodeURIComponent. Correct when the URL is itself a parameter value (?redirect=https%3A%2F%2F…), wrong otherwise.
  • Slashes in path segments. A file name containing / must be encoded as %2F, and many servers decode it back before routing, causing 404s. Avoid slashes in identifiers.
  • Fragment. Everything after # is never sent to the server.

In other languages

Language Component encode Decode
Python urllib.parse.quote(s, safe='') urllib.parse.unquote(s)
PHP rawurlencode($s) (urlencode uses +) rawurldecode($s)
Java URLEncoder.encode(s, "UTF-8") (form style, +) URLDecoder.decode
Go url.QueryEscape(s) / url.PathEscape(s) url.QueryUnescape
C# Uri.EscapeDataString(s) Uri.UnescapeDataString
Ruby CGI.escape(s) / ERB::Util.url_encode CGI.unescape

Worked examples

Component: name=Jürgen & sons; 50% off? → name%3DJ%C3%BCrgen%20%26%20sons%3B%2050%25%20off%3F

Every reserved character is escaped, including = and &, so the whole string is safe as one query value.

Full URL: https://example.com/path with spaces/?q=café au lait#section 2 → https://example.com/path%20with%20spaces/?q=caf%C3%A9%20au%20lait#section%202

Structure (://, /, ?, =, #) is kept; spaces and é are encoded.

Form data: a b+c → a+b%2Bc

The space becomes +, so the literal plus sign must become %2B.

Decode: https%3A%2F%2Fexample.com%2F%3Fq%3Dcaf%C3%A9 → https://example.com/?q=café

The parsed-URL table then shows the host, path and each query parameter separately.

Double-encoded: caf%25C3%25A9 → caf%C3%A9, with a note that the input is 2× encoded. Decode once more to reach café.

Frequently asked questions

What is the difference between encodeURI and encodeURIComponent?

encodeURIComponent encodes every reserved character, so it is right for a single query value. encodeURI leaves :/?#&= and similar intact, so a whole URL still works. Use Component mode for values and Full URL mode for addresses.

Should a space be %20 or +?

In the path, %20. In application/x-www-form-urlencoded query strings, + is also accepted as a space. This tool encodes as %20 and decodes both.

Why is my decoded text still encoded?

It was probably encoded twice (%2520 is an encoded %20). Click Decode again.

How are non-ASCII characters encoded?

As UTF-8 bytes, each percent-encoded, so é becomes %C3%A9.

URL encode / decode · last updated · changelog · part of Canned Tuna