Percent-Encoding (RFC 3986) Tool

Enter text and choose encode or decode for strict RFC 3986 percent-encoding.

How it is calculated

In encode mode the text is converted to its UTF-8 bytes and every byte except A–Z a–z 0–9 - . _ ~ is written as %XX, where XX is the byte in hexadecimal. A space becomes %20, never a plus sign. Characters outside ASCII use several bytes, so one letter such as é becomes two sequences (%C3%A9). In decode mode each %XX is turned back into its byte; a plus sign is left as a plus sign, not turned into a space. The length line counts the bytes of the output text. Empty input returns nothing, and the mode defaults to encode if not specified.

Worked example

Encode the text café & tea? (12 bytes, because é takes two). Letters stay as they are. The first space becomes %20, é becomes %C3%A9, the ampersand becomes %26, the second space becomes %20 and the question mark becomes %3F. The result is caf%C3%A9%20%26%20tea%3F, which is 24 bytes long. Switching to decode mode with this string returns the original text.

Try this example →

Common mistakes

  • Expecting a space to become a plus sign. This tool follows RFC 3986 and gives %20; plus signs are only a form-encoding convention and are not converted on decode.
  • Encoding a whole URL. The slashes, colon and question mark would be escaped and the link would stop working, so encode only the individual parameter values.
  • Encoding the same string twice. A % in already-encoded text becomes %25, giving results like %2520 that the server decodes only once.
  • Decoding text that contains a stray % not followed by two hex digits; such parts are left as they are, so check the source for typos.
  • Reading the length as the input size. It counts the bytes of the output, so an encoded string is longer than the original.

Sources

About this calculator

RFC 3986 defines the syntax of URIs and reserves a small unreserved character set — letters A–Z, a–z, digits 0–9, and the four symbols - . _ ~ — as the only characters that never need escaping. Every other byte, including spaces, reserved delimiters like ? & / #, and non-ASCII characters, must be represented as a percent sign followed by its two-digit hexadecimal byte value (e.g. a space becomes %20), so the resulting string can safely travel inside a URL without breaking its structure.

This tool applies that exact rule set to encode arbitrary text into a URL-safe form, or reverses the process to decode a percent-encoded string back to readable text. Web developers use it when building query strings or redirect URLs by hand, and API developers and QA engineers use it to debug why a request parameter isn't matching what the server expects.

Was this helpful?

You can pick up to 3 reactions.

Comments (1)

  • Editorial team

    Encode a single value, such as one query parameter, not a whole address: the colon and slashes of a full URL are not in the unreserved set, so they would be turned into %3A and %2F and break it. Spaces come out as %20. Form submissions use a plus sign for spaces, and decoding here leaves a plus untouched, so swap pluses for spaces first when decoding that kind of data. Which text are you encoding?

Popular calculators

All Calculators