URL Encoder and Decoder (Percent-Encoding) – Free

URL encode a value so it is safe inside a query string or path segment, or URL decode percent-encoded text back to its readable form. The tool uses UTF-8 and runs locally.

How to use the URL encode / decode tool

  1. Pick Encode or Decode in the Operation field.
  2. Enter one URL component, such as a parameter value, in Text or encoded value. Do not paste a whole URL when encoding.
  3. Select Convert. The Example button encodes Hello, world! and returns Hello%2C%20world! as the result.
  4. Check the converted value in the Result box.
  5. Select Copy and paste the value into your URL, request or code.

How URL encoding works

A URL may contain only a limited set of ASCII characters, and some of those, such as the question mark, ampersand, equals sign and slash, separate its parts. Percent-encoding, specified in RFC 3986, lets any other data travel inside a URL. The character is converted to UTF-8 bytes, and each byte is written as a percent sign followed by two hex digits.

A space is the byte 20, so it becomes %20. The letter é is two bytes in UTF-8 and becomes %C3%A9. Decoding reverses the steps: each %XX turns back into a byte, and the byte sequence is read as UTF-8.

URL encode example

Suppose a search value contains its own equals sign and ampersand. Left raw, they would be read as parameter separators. Encoded, the whole string is a single value. The second sample shows a literal percent sign becoming %25.

q=café au lait&lang=fr
→  q%3Dcaf%C3%A9%20au%20lait%26lang%3Dfr

100% sure?
→  100%25%20sure%3F

Which characters are encoded

The tool calls the JavaScript functions encodeURIComponent and decodeURIComponent. Encoding leaves letters, digits and nine marks untouched: hyphen, underscore, period, exclamation mark, tilde, asterisk, apostrophe and both parentheses. Everything else is escaped, including the reserved characters that structure a URL.

That behavior is meant for one component at a time. If you encode a complete address, the colon and slashes after the scheme are escaped too and the link breaks. Encode each parameter name and value separately, then join them.

RFC 3986 lists the exclamation mark, asterisk, apostrophe and parentheses as reserved, yet this function keeps them. If you sign requests, as with OAuth 1.0 or AWS Signature Version 4, escape those five characters yourself.

Why URL decoding fails

Decoding is strict. An invalid sequence stops the conversion with the browser's own error text, which is URI malformed in Chrome.

Two things are not errors but often surprise people. A plus sign is not turned into a space, so replace + with %20 before decoding form data. A value that was encoded twice needs two passes.

  • A percent sign that is not followed by two hex digits, as in 100% or %zz. A literal percent sign must be written as %25.
  • Bytes that are not valid UTF-8, such as %E9 from a Latin-1 system where é was a single byte.
  • A sequence cut off in the middle of a multi-byte character, for example %E6%9D without its third byte.

Frequently asked questions

What is the difference between %20 and + for a space?

%20 is the percent-encoding of a space and is valid anywhere in a URL. The plus sign means space only in form-encoded data. This tool writes %20 when encoding and leaves + unchanged when decoding.

Should I use encodeURI or encodeURIComponent?

Use encodeURIComponent, which this tool applies, for individual values such as query parameters and path segments. encodeURI is for a complete URL and keeps separators like the slash, question mark and ampersand intact.

Why do I see %25 in my URL?

%25 is an encoded percent sign. It usually appears when an already encoded value gets encoded again, turning %20 into %2520. Decode once to get back %20, and fix the code that encodes twice.

How are non-English characters encoded?

They are converted to UTF-8 and every byte is escaped. A Chinese or Japanese character usually takes three bytes and so becomes nine characters, such as %E6%9D%B1.

Is URL encoding a way to hide or secure data?

No. Percent-encoding is a transport format that anyone can reverse. It prevents characters from being misread as URL syntax and offers no secrecy, so encoded passwords or tokens in a URL are still exposed.

Does the tool send my URL or parameters to a server?

No. It runs the browser's built-in encoding functions on your input inside the page. The text is not included in any network request.

Related tools