HomeDeveloper ToolsURL Encode/Decode

encode. decode. clean urls.

encode or decode URL strings in real time. supports both encodeURIComponent and encodeURI modes.

Component mode — uses encodeURIComponent. Encodes all special characters including /, ?, &.

input
output

encoded output will appear here

What this tool does

Encode any string for safe inclusion in a URL, or decode a URL-encoded string back to its original. Bidirectional, instant, runs in your browser.

Why URL encoding exists

URLs reserve a small set of characters for structural meaning: / separates path segments, ? starts the query string, & separates query parameters, = separates a parameter name from its value, # marks a fragment. If your data contains any of these characters and you drop it into a URL raw, the parser cannot tell where the data ends and the structure begins.

URL encoding (also called percent-encoding) replaces unsafe characters with their hex byte values prefixed by %. The space character becomes %20; the ampersand becomes %26; non-ASCII characters become their UTF-8 byte sequences each percent-encoded.

text
Original:  hello world & friends
Encoded:   hello%20world%20%26%20friends

The two flavors most languages provide

JavaScript (and most other languages) provides two URL encoding functions that differ in how aggressive they are:

  • encodeURI() — encodes only the characters that would break URL parsing if left raw. Leaves /, ?, &, and similar reserved characters alone. Use when encoding a complete URL whose structure should be preserved.
  • encodeURIComponent() — encodes everything that has any URL meaning, including the reserved characters. Use when encoding a single parameter value that will be inserted into an existing URL.

The right pick is almost always encodeURIComponent() for query parameter values. Using encodeURI() on a value containing & or = will produce a URL that appears to have extra parameters where you only meant to have one.

Common edge cases

  • Plus signs in encoded form data. Form submissions encode space as + rather than %20 (this is the application/x-www-form-urlencoded format, which differs from generic URL encoding). When decoding, both forms should be treated as a space.
  • Double encoding. Encoding an already-encoded string produces gibberish: %2520 (which decodes to literal %20, not a space). The fix is decoding once before re-encoding, or checking for percent signs in input before encoding.
  • Non-ASCII characters. URLs were originally ASCII-only. Modern browsers display non-ASCII characters in the address bar but encode them on the wire. The encoded form of café in a URL is caf%C3%A9 (the UTF-8 bytes for é, each percent-encoded).

Browser-only execution

URL encoding is a pure local computation — every browser ships encodeURIComponent and decodeURIComponent as native functions. The tool wraps those, runs locally in the tab, and never sends your input anywhere.

What this tool does

Encode any string for safe inclusion in a URL, or decode a URL-encoded string back to its original. Bidirectional, instant, runs in your browser.

Why URL encoding exists

URLs reserve a small set of characters for structural meaning: / separates path segments, ? starts the query string, & separates query parameters, = separates a parameter name from its value, # marks a fragment. If your data contains any of these characters and you drop it into a URL raw, the parser cannot tell where the data ends and the structure begins.

URL encoding (also called percent-encoding) replaces unsafe characters with their hex byte values prefixed by %. The space character becomes %20; the ampersand becomes %26; non-ASCII characters become their UTF-8 byte sequences each percent-encoded.

text
Original:  hello world & friends
Encoded:   hello%20world%20%26%20friends

The two flavors most languages provide

JavaScript (and most other languages) provides two URL encoding functions that differ in how aggressive they are:

  • encodeURI() — encodes only the characters that would break URL parsing if left raw. Leaves /, ?, &, and similar reserved characters alone. Use when encoding a complete URL whose structure should be preserved.
  • encodeURIComponent() — encodes everything that has any URL meaning, including the reserved characters. Use when encoding a single parameter value that will be inserted into an existing URL.

The right pick is almost always encodeURIComponent() for query parameter values. Using encodeURI() on a value containing & or = will produce a URL that appears to have extra parameters where you only meant to have one.

Common edge cases

  • Plus signs in encoded form data. Form submissions encode space as + rather than %20 (this is the application/x-www-form-urlencoded format, which differs from generic URL encoding). When decoding, both forms should be treated as a space.
  • Double encoding. Encoding an already-encoded string produces gibberish: %2520 (which decodes to literal %20, not a space). The fix is decoding once before re-encoding, or checking for percent signs in input before encoding.
  • Non-ASCII characters. URLs were originally ASCII-only. Modern browsers display non-ASCII characters in the address bar but encode them on the wire. The encoded form of café in a URL is caf%C3%A9 (the UTF-8 bytes for é, each percent-encoded).

Browser-only execution

URL encoding is a pure local computation — every browser ships encodeURIComponent and decodeURIComponent as native functions. The tool wraps those, runs locally in the tab, and never sends your input anywhere.

more free tools

PDF utilities, image tools, developer helpers — all free, no signup.

Something wrong?