Less paperwork. More possibility.
Help & guides

URL Encoder / Decoder

Percent-encode or decode text, query strings, and full URLs

Uses encodeURIComponent — escapes every character that isn't safe in a single URL segment or query value, including / : ? & = and space.

Type or paste something above — the result updates automatically as you type.

How to Encode or Decode a URL

1

Pick Encode or Decode

Choose "Encode" to turn readable text into a URL-safe string, or "Decode" to turn a percent-encoded string back into readable text.

2

Choose the Right Mode

Use "URI Component" for a single value like a query parameter or path segment. Use "Full URI" when you already have a complete, structured URL you just want to make safe.

3

Copy the Output

The result updates live as you type. Use "Swap" to immediately reverse the operation on the output, or "Copy" to grab the result.

Component vs. Full URI: The Difference That Actually Matters

✓ encodeURIComponent Escapes Everything Reserved

encodeURIComponent treats its input as one opaque piece of data, so it escapes / : ? # & = + $ , and space. That's exactly what you want when building a query string value: if a search term itself contains an &, you need it encoded to %26 so it isn't mistaken for the separator between two different parameters.

✓ encodeURI Preserves URL Structure

encodeURI assumes you're handing it a complete URL, so it leaves : / ? # & = alone — encoding them would break the URL's own syntax — while still escaping spaces and non-ASCII characters like accented letters or emoji.

✓ A Concrete Example

Encoding https://a.com/s?q=1&2 with encodeURI gives you back almost the same string (only unsafe characters change), keeping the ? and & intact. Encoding the same string with encodeURIComponent turns the :, /, ?, and & into %3A %2F %3F %26 — useless as a URL on its own, but exactly right for embedding as one value inside another URL.

✓ Processed Locally, Not Sent Anywhere

Encoding and decoding happen with JavaScript's built-in functions right in your browser tab. That matters if what you're encoding is an internal API URL, an auth callback with a token in it, or anything else you'd rather not paste into a random server-side tool.

Frequently Asked Questions

Why did decoding fail with an error instead of showing something?

decodeURIComponent and decodeURI both throw a URIError when they encounter a "%" that isn't followed by exactly two valid hexadecimal digits, or a sequence that decodes to an invalid UTF-8 byte pattern. This usually means the string was cut off, double-encoded incorrectly, or was never a properly percent-encoded string to begin with. This tool catches that error and shows you a plain-English explanation instead of letting it crash.

Should I encode an entire URL with encodeURIComponent?

Only if that whole URL is itself being embedded as a value inside another URL — for example, a "redirect" or "returnUrl" query parameter. If you run encodeURIComponent on a normal top-level URL, it will escape the :// and every /, which almost no server will interpret correctly as a URL. For a normal, standalone link, use "Full URI" mode (encodeURI) instead, or simply don't encode it at all if it's already valid.

Does this handle "+" as a space, like old-style form encoding?

No. encodeURIComponent/decodeURIComponent follow the URI percent-encoding standard, where a literal space becomes %20. The convention where "+" means space comes from a different, older format (application/x-www-form-urlencoded, used by HTML forms), not from the URI spec these JavaScript functions implement — so a "+" here is treated as a literal plus sign, not a space.

Why does encoding non-English text produce a long string of %XX codes?

URLs are technically restricted to a limited set of ASCII characters. Any character outside that set — accented letters, non-Latin scripts, emoji — first gets converted to its UTF-8 byte representation, and each of those bytes is then percent-encoded individually. That's why a single accented character or emoji can expand into two, three, or four "%XX" groups.

Prepare URL text for the right context

Encode URL components or full URLs and decode valid percent-encoded strings. Choose the right mode for query values or complete addresses.

Steps for url encoder and decoder

  1. Enter a URL or component.
  2. Select whole-URL or component handling.
  3. Encode or decode and inspect the result.

Which mode should I use for a query value?

Component encoding is intended for individual values; whole-URL encoding preserves URL separators.

Related tools