ZapKit

URL Encoder & Decoder

Percent-encode text for a URL or decode it back, choosing between query-value, whole-URL and form encoding, and see any URL split into its parts.

What is URL encoding?

URL encoding, or percent-encoding, replaces characters that aren't allowed or have special meaning in a URL with a % and their byte value in hexadecimal. Spaces, ampersands, non-English letters and emoji all have to be encoded before they can safely go in a link, a query string or an API request.

This tool encodes and decodes in the three common styles and explains which to use. It also takes any full URL and lists its protocol, host, path, fragment and every decoded query parameter, which is handy for debugging tracking links and redirects.

How to use the URL Encoder

  1. 1.Choose encode or decode

    Then choose what you're encoding: a query value, a whole URL, or form data.

  2. 2.Paste the text

    The result updates as you type.

  3. 3.Inspect the URL

    Full URLs are broken down into protocol, host, path and each query parameter.

Example: a query value with symbols

Encoding café & chai? price=₹99 / cup as a query value:

é
%C3%A9 (two UTF-8 bytes)
& and ?
%26 and %3F
₹
%E2%82%B9 (three bytes)
Spaces
%20

Encoded, the & can't be mistaken for the start of another query parameter.

Component, URL and form encoding

encodeURIComponent, for query values and path segments, escapes everything except letters, digits and - _ . ! ~ * ' ( ). encodeURI, for a whole URL, leaves characters with special meaning in URLs, such as / ? & = and #, untouched. Using the wrong one is the classic bug that breaks links with & in them.

HTML forms submit spaces as + rather than %20. Form mode encodes and decodes that way. Non-ASCII characters are converted to UTF-8 bytes first, so ₹ becomes %E2%82%B9.

Frequently asked questions

What does %20 mean?

A space. Percent-encoding writes a byte as % followed by two hexadecimal digits; 20 is the space character.

Should spaces be %20 or +?

%20 is correct everywhere in a URL. + means space only in form-encoded query strings.

Why did decoding fail?

A % that isn't followed by two hex digits, like 100%, isn't valid percent-encoding.

Which mode do I need for a query parameter?

Component mode. It escapes & and = so they can't break the parameter apart.

More Developer tools