URL Encoder / Decoder

Converter

Encode or decode URL-safe strings using percent-encoding for query params and path segments. Essential for building safe query strings and REST API URLs.

Ready
Decoded URL
0 chars
Encoded URL
0 chars

About URL Encoder / Decoder

URL encoding, or percent-encoding, turns spaces, non-ASCII characters, and special symbols into a percent sign plus two hex digits so URLs travel safely through protocols. This tool follows RFC 3986 and supports both encodeURIComponent and encodeURI modes, auto-detecting already-encoded input. For example it encodes a b as a%20b and encodes a Chinese path into a safely transportable form. Encoding runs locally in your browser and request parameters containing tokens or keys are never uploaded.

How to Use

  1. Open the URL Encoder / Decoder tool
  2. Select the source and target formats
  3. Adjust the output options as needed
  4. Click the Convert button; results appear in real time
  5. Copy or export the result

Use Cases

  • Build query parameters — User input (non-ASCII, special chars) must be encoded before being appended to a URL, otherwise the backend will mis-parse it.
  • Debug GET requests — URLs copied from browser DevTools Network tab are encoded — use this tool to read the original text.
  • Handle special filenames — When uploading filenames with spaces or non-ASCII chars, HTTP paths require encoding for correct routing.
  • OAuth callback URLs — The redirect_uri parameter is itself a URL — when nested as a query parameter it needs double-encoding.
  • Mailto links — Pre-filled subject and body in mailto: links must be URL-encoded for special characters.
  • Form data encoding — Encode application/x-www-form-urlencoded form payloads so that special characters in field values are transmitted correctly.
  • Cookie value encoding — Percent-encode special characters in cookie values to comply with HTTP cookie specification requirements.

FAQ

How is URL encoding different from HTML entity encoding?

Entirely different. URL encoding uses %XX to represent bytes (space → %20). HTML entities use & + name (< → &lt;). The former is for URLs, the latter for HTML body text.

Why is space sometimes + and sometimes %20?

application/x-www-form-urlencoded (form submission) uses + for space; URL paths and most modern contexts use %20. This tool defaults to %20.

Which characters need encoding?

RFC 3986 "unreserved" characters (A-Z, a-z, 0-9, - _ . ~) never need encoding. Others should be?#&= depend on position — encoded inside query values, raw as delimiters.

What happens if I encode twice?

You get %25XX (an encoded percent sign) — and a single decode only unwraps one layer. This is the most common backend bug; encode exactly once.

Can I put non-ASCII characters directly in a URL?

Modern address bars display them, but under the hood they're encoded as UTF-8 bytes + %XX. When constructing URLs in code, encode manually.

What's the difference between encodeURI and encodeURIComponent?

encodeURI leaves URI delimiters such as : / ? # & = unescaped, making it suitable for encoding a whole URL; encodeURIComponent escapes even those delimiters, making it correct for encoding query parameter values. The most common mistake is swapping them: using encodeURI on a value lets embedded & or = act as separators so the backend splits fields wrongly and returns 400, while using encodeURIComponent on a whole URL mangles the scheme and host. Build params by encoding each key/value with encodeURIComponent and joining with & — that's the safest pattern.

Why does my backend see garbled params or return 400?

Two usual causes. One is a charset mismatch: the frontend encodes as UTF-8 but the backend decodes as GBK or ISO-8859-1, turning non-ASCII text into mojibake. The other is double-nested URLs that were only encoded one layer or not at all, so & and = inside values like redirect_uri are taken as new parameters. To debug, copy the real request URL sent from the browser Network panel and decode it here to read the original; then confirm both sides use UTF-8; and double-encode any value that is itself a URL. Restoring and comparing segment by segment usually pinpoints the failing layer immediately.

Advertisement