Development

URL Encoder / Decoder

Percent-encode or decode URLs and query values as you type, with component, full-URL and form (+ for spaces) modes, clear errors, and a query-string breakdown.

URL Encoder / Decoder
Type on either side. The other side updates as you type.

For a complete URL. Keeps the characters that give a URL its structure (: / ? # & = and others) and escapes spaces, non-ASCII letters and other unsafe characters. Decoding leaves escaped structure characters such as %2F alone.

URL breakdown
2 query parameters, decoded (+ read as a space).
Scheme
https
Host
example.com
Path
/search
#KeyValue (decoded)Raw
1qcafé crèmeq=caf%C3%A9%20cr%C3%A8me
2langfrlang=fr

About this tool

The URL Encoder / Decoder converts text to and from percent-encoding live in both directions: type plain text on one side to get the encoded form, or paste an encoded string on the other to read it. Choose the mode that matches where the text is going. Component mode works like encodeURIComponent and escapes everything except letters, digits and - _ . ! ~ * ' ( ), which is right for a single query value or path segment. Full URL mode works like encodeURI and leaves the characters that give a URL its structure, such as : / ? # & =, untouched. Form mode follows HTML form encoding, with + for spaces. Decoding points to the exact position of a broken % sequence or invalid UTF-8 instead of just failing. When the text is a URL or query string, a table breaks it into its scheme, host, port, path, fragment and every query parameter, decoded. It all runs in your browser.

How to use the URL Encoder / Decoder

  1. Pick a mode: Component for a single value, Full URL for a whole address, or Form for HTML form data.
  2. Type or paste plain text in the left box to encode it, or encoded text in the right box to decode it.
  3. If decoding fails, the message points to the broken % sequence.
  4. When the text is a URL or query string, read each part and parameter in the breakdown table.
  5. Copy either side with its copy button.

Use it from your code

The URL Encoder / Decoder is also a REST API endpoint. Create a free API key and call it from your own scripts and apps.

# Encode a query value
curl -X POST https://opentools.ca/api/v1/tools/url-encoder-decoder \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "café crème & more", "direction": "encode", "mode": "component"}'

# Decode form data
curl -X POST https://opentools.ca/api/v1/tools/url-encoder-decoder \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text": "a+b%26c", "direction": "decode", "mode": "form"}'

Give us your feedback

Help us improve URL Encoder / Decoder!

Frequently asked questions

What is the difference between encodeURIComponent and encodeURI?

encodeURIComponent escapes everything that has a special meaning in a URL, including / ? & = and #, so use it for one value you are inserting into a URL. encodeURI leaves those characters alone because it expects a complete URL, so it only escapes things like spaces and non-ASCII letters.

Should spaces be %20 or +?

In paths and most query strings, %20. The + for spaces comes from HTML form encoding (application/x-www-form-urlencoded), which is what browsers send for form submissions and what URLSearchParams produces. Use Form mode when you need that.

Why does decoding fail with "not valid UTF-8"?

Percent-encoded bytes are read as UTF-8. A sequence like %E9 is an accented e in the old Latin-1 encoding but is incomplete in UTF-8. The text was probably encoded by a system using another character set.

Is anything sent to a server?

No. Encoding, decoding and the URL breakdown all happen in your browser.

URL Encoder / Decoder screenshot