Encode

URL Encoder

Percent-encode or decode URL components

Input
Output

Percent-encode strings for safe use in URL query parameters, path segments, or form data. Handles spaces, special characters, and Unicode automatically.

What URL encoding solves

URLs have a strict grammar: only a small set of characters — letters, digits, and a handful of punctuation marks — are allowed to appear unescaped. Everything else must be percent-encoded, where each byte becomes %XX (XX being the hex representation). Without encoding, a query parameter containing a space, ampersand, or plus sign would break the URL structure and produce unexpected results server-side.

encodeURIComponent vs encodeURI

  • encodeURIComponent (what this tool uses) escapes almost everything: :, /, ?, #, & and = all get encoded. Use it for individual query parameter values.
  • encodeURI is more permissive — it leaves those reserved characters alone because they have structural meaning in a full URL. Use it on an entire URL string, not on individual parts.
  • Getting these mixed up is the root cause of most URL-encoding bugs.

Common characters and their encodings

  • Space → %20 (or + in form data, but not in paths).
  • Ampersand & → %26 — critical because unencoded & terminates a query parameter.
  • Plus + → %2B — in form data, raw + is interpreted as a space, so always encode it in values.
  • Hash # → %23 — unencoded # starts a URL fragment.
  • Emoji and non-ASCII → multi-byte UTF-8 encoding.

Frequently asked questions

Why does my encoded URL still not work?

The most common cause is double-encoding. If a string is already encoded (contains %XX sequences) and you encode it again, the percent signs themselves get encoded to %25. Decode first, then re-encode only if necessary.

Should I encode the entire URL or just the query parameters?

Only encode the parts that need it — typically query parameter values and, occasionally, path segments containing special characters. Encoding the protocol, domain, or structural separators (/, ?, &) will break the URL.