Developer Tools

URL Encoder & Decoder

Percent-encode and decode URL components or whole URLs, with a clear explanation of when to use which.

Loading tool…

How to use the URL Encoder & Decoder

  1. Choose Encode or Decode.
  2. Choose “URL component” for a single value (a query parameter, a path segment) or “Complete URL” for a whole address.
  3. Type or paste into the input. The result appears immediately and malformed input shows an error.
  4. Copy the result, or use “Use result as input” to reverse it. For complete URLs, a breakdown of the host, path and query parameters is shown.

Good to know

  • “URL component” uses encodeURIComponent/decodeURIComponent. “Complete URL” uses encodeURI/decodeURI, which leave reserved characters such as : / ? # & = untouched. Decoding a complete URL therefore does not turn %2F or %26 back into / or &.
  • Non-ASCII characters are encoded as their UTF-8 bytes, for example é becomes %C3%A9.
  • The “+ for spaces” option switches to application/x-www-form-urlencoded style, used by HTML form submissions. In a normal URL path, a + is a literal plus sign.
  • A text containing a lone surrogate (a broken emoji) cannot be encoded and reports an error. Input is limited to 500,000 characters.

Examples

Encode a query value
a&b=c d (URL component) → a%26b%3Dc%20d The & and = no longer look like parameter separators.
Encode a whole URL
https://example.com/café menu?q=1 (Complete URL) → https://example.com/caf%C3%A9%20menu?q=1 The :, /, ? and = are kept so the URL still works.
Spot a bad sequence
100% sure → Error: a “%” must be followed by two hexadecimal digits (position 4).

Frequently asked questions

When should I use encodeURI instead of encodeURIComponent?

Use Complete URL when you have a full address that only needs unsafe characters such as spaces fixed. Use URL component for any piece you insert into a URL, because it also escapes the characters that give a URL its structure.

Why does decoding fail with “Malformed percent-encoding”?

A “%” in a URL must be followed by two hex digits (for example %20). A literal percent sign should itself be written as %25.

Is this the same as HTML entity escaping?

No. URL percent-encoding (%20) and HTML entities (&) are different mechanisms for different contexts.

Built By Engineers

Need Something Built For Your Business?

aimEncoders designs and builds custom software, websites and internal tools, backed by automated QA.

  • Reply within 1 business day
  • Fixed quote, no surprise invoices
  • You own 100% of the code

Free discovery call • Straight to a developer • Strict NDA available

URL Encoder & Decoder – Percent-Encode URLs and Components | aimEncoders