Skip to content

URL Encoder / Decoder

Percent-encode and decode URLs and query strings.

Runs in your browser

Paste a URL or a parameter to encode or decode. We expose both encodeURI (for full URLs) and encodeURIComponent (for individual parameters), so you pick the right one.

encodeURIComponent (for parameter values)

https%3A%2F%2Farnaud.app%2F%3Fq%3Dhello%20world%26lang%3Den

encodeURI (for full URLs)

https://arnaud.app/?q=hello%20world&lang=en

How to use it

  1. Pick encode or decode

    Encode turns plain text into percent-encoded form; decode reverses it.

  2. Choose the right encoder

    encodeURIComponent for individual parameter values, encodeURI for full URLs. We show both side by side.

  3. Copy the result

    Drop the encoded or decoded string straight into your URL, fetch call or log message.

What is it?

URL encoding (also known as percent-encoding) replaces any character that has a reserved meaning in a URL with a '%' followed by its hexadecimal byte value. That turns ' ' into '%20', '&' into '%26' and so on, so the URL parser doesn't mistake a value for structure. Two JavaScript primitives do the work: encodeURIComponent escapes everything that has meaning in a URL (right for parameter values), while encodeURI leaves URL structure intact (right for full URLs).

When to use it

Encode any user-supplied string before putting it in a URL - query parameter values, path segments, fragment identifiers, redirect URLs and Open Graph share links. Decode when you're reading values that were encoded for transport: query strings from analytics, OAuth callback parameters, server logs, or any URL that contains '%xx' sequences.

Common mistakes

Mixing up encodeURIComponent and encodeURI is the classic bug - encodeURI leaves '&', '?' and '=' alone because they're structural, so using it on a value with '&' breaks the URL. Don't double-encode: encoding an already-encoded string corrupts it. And don't try to encode parameter names manually; let URLSearchParams or your HTTP library handle it.

FAQ

When should I use encodeURIComponent vs encodeURI?
Use encodeURIComponent for individual query parameter values - it escapes characters like `&` and `=` that have meaning in URLs. Use encodeURI on a full URL when you only want to escape illegal characters.

More in this category