URL Encoder and Decoder

Make any text safe to put in a web address, or read an encoded address back as plain text. Encoding replaces spaces, symbols and non-English letters with percent codes such as %20 and %C3%A9; decoding turns them back. Choose whether spaces become + as in web forms, then copy or download the result. A broken code is pointed out by position. Your text stays in your browser.

Inputs

Result

Encoded text
name%3DZo%C3%AB%20%26%20Co%20%2F%2050%25%20off%3F
Characters before
24
Characters after
49

How it is calculated

  1. Encoded text: start from the text to encode, then percent-encode every character except letters, digits and - . _ ~ as UTF-8 bytes
  2. Characters before: start from the text to encode, then convert Windows and old Mac line endings to standard line breaks, then count characters as you see them, including spaces
  3. Characters after: start from the encoded text, then count characters as you see them, including spaces

Resources for your next step

Helpful downloads

View all developer & web downloads
Store coming soon

We are preparing practical spreadsheets, planners, and guides. Explore the store page for what is next.

Why web addresses need encoding

A URL may only contain a limited set of ASCII characters, and several of them have jobs: ? starts the query string, & separates parameters, = joins a name to its value, / separates path segments and # starts a fragment. A value that contains one of these, or a space or a letter such as é, must be percent-encoded so the browser and server read it as data rather than structure.

Percent-encoding, defined in RFC 3986, writes each byte as a % followed by two hexadecimal digits. Text is first converted to UTF-8 bytes, so é becomes two bytes and is written %C3%A9, and an emoji becomes four codes.

What this encoder changes

It keeps only the unreserved characters unchanged: letters A to Z and a to z, digits, hyphen, period, underscore and tilde. Everything else is encoded, including / ? & = and #. That is the safe choice for a single query value or path segment. It is slightly stricter than JavaScript's encodeURIComponent, which leaves ! * ' ( and ) unencoded; encoding them as well is always allowed.

In the example, "name=Zoë & Co / 50% off?" turns the = into %3D, the ë into the two codes %C3%AB, each space into %20, the & into %26, the / into %2F, the % sign itself into %25 and the ? into %3F. Letters and digits stay as they are. If you need to encode a whole address, encode each value separately and then join them, or the slashes and question marks will be encoded too.

Plus signs and spaces

HTML forms send data in the application/x-www-form-urlencoded format, where a space is written as + instead of %20. Turn on the plus option when you are building a query string the way a form would. When decoding, the + as space option is on by default because most encoded strings you meet come from query strings; turn it off for path segments, where + is a literal plus sign.

Decoding stops with a message if a % is not followed by two hexadecimal digits, or if the codes do not spell valid UTF-8, and tells you the character position so you can find the problem in a long string.

Frequently asked questions

What does %20 mean in a link?

It is an encoded space. The two digits after % are the byte value in hexadecimal; 20 is the code for a space.

Should a space be %20 or +?

Both are common. %20 works everywhere in a URL. + means a space only in query strings and form data, so use %20 unless you are mimicking a form.

Why is my slash or question mark encoded?

This tool encodes everything except letters, digits and - . _ ~, which is right for a single value. Encode each part of an address separately, then add the / ? & and = yourself.

Why do accented letters turn into two codes?

Text is encoded as UTF-8, where letters outside basic English take two to four bytes. Each byte gets its own % code, so é is %C3%A9.

What does the error about an invalid percent code mean?

A % sign must be followed by two hexadecimal digits (0–9 and A–F). A stray %, as in "50%" that was never encoded, cannot be decoded. Encode the original text instead, or fix that spot.

Is encoding the same as encrypting a URL?

No. Percent-encoding only rewrites characters so they travel safely. Anyone can decode it, so it does not hide anything.

Sources

Text is processed in your browser and never sent anywhere. Check the result before using it in a live link or application.

All developer & web tools