Skip to content
codevory

URL Encoder

Percent-encode text for URLs: a single component, a full URL, or form data. Unicode is encoded as UTF-8.

URL Encoder: the tool

Type or paste text to percent-encode it.

Input

Encoded

The result appears here.

How to use URL Encoder

  1. Paste the text or URL to encode.
  2. Pick the mode. Component encodes everything except letters, digits and - _ . ! ~ * ' ( ), which is right for a single query value or path segment.
  3. Pick Full URL to keep the structure of a complete address (: / ? # & =) and only encode what would break it.
  4. Pick Form data for application/x-www-form-urlencoded, where a space becomes + and more symbols are encoded.

Example

The same address encoded as a component and as form data. Notice the space: %20 in the first, + in the second.

Input
https://example.com/search?q=café & crème&lang=fr
Component
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dcaf%C3%A9%20%26%20cr%C3%A8me%26lang%3Dfr
Form data
https%3A%2F%2Fexample.com%2Fsearch%3Fq%3Dcaf%C3%A9+%26+cr%C3%A8me%26lang%3Dfr

About this tool

A URL can only contain a limited set of ASCII characters. Everything else, including spaces, accents and symbols that have a special meaning in the address, is written as a percent sign followed by the byte value in hexadecimal: a space is %20 and é is %C3%A9, because é takes two bytes in UTF-8.

The mode matters. Encoding a whole URL as a component also encodes the :, / and ? that make it a URL, producing a string that no longer works as an address. Encoding a query value in Full URL mode leaves & and = alone, which can silently split one value in two. The three modes follow encodeURIComponent, encodeURI and the form encoding of the WHATWG URL standard.

Everything is converted in your browser, so URLs that contain tokens or internal host names stay on your device.

Which mode to use

ModeSame asLeaves unencodedUse it for
ComponentencodeURIComponent()A-Z a-z 0-9 - _ . ! ~ * ' ( )One query value, path segment or fragment
Full URLencodeURI()Component set plus ; , / ? : @ & = + $ #A complete URL that may contain spaces or accents
Form dataURLSearchParamsA-Z a-z 0-9 * - . _Request bodies and query strings built by HTML forms

Frequently asked questions

What is the difference between encodeURI and encodeURIComponent?

encodeURIComponent encodes everything that is not a letter, digit or one of - _ . ! ~ * ' ( ), so it is meant for individual values. encodeURI leaves the characters that structure a URL alone, so it is meant for a whole address.

Should a space be %20 or +?

In a path, always %20. In a query string both are understood by servers, but + only means a space in form encoding. When in doubt, use %20, which is valid everywhere.

Why is é encoded as %C3%A9?

Percent-encoding works on bytes, and é is the two bytes C3 A9 in UTF-8. This is the encoding every modern browser and server expects.

Why does encoding fail on some text?

A string containing an unpaired surrogate (half of an emoji, for example) has no UTF-8 representation. The error shows its position so you can remove it.

Do I need to encode a URL twice?

No. Encoding twice turns % into %25 and produces values like %2520 that servers decode to the wrong text. Encode each value once, when you build the URL.