URL Percent-Encoder & Decoder (RFC 3986)

RFC 3986 %20 vs Form + mode · Encodes !'()* for AWS SigV4 · Local only

Presets:
Input Text or Encoded URL 0 chars
Encoded / Decoded Output
0 chars

      
Ready
Ctrl+Enter Convert · 100% Local
Advertisement
Reserved fixed-height slot (CLS = 0.00) 728×90 320×100 300×50

RFC 3986 Percent-Encoding vs application/x-www-form-urlencoded

URL encoding errors are one of the most frequent causes of broken OAuth redirects, double-encoded S3 presigned URLs, and invalid AWS Signature Version 4 hashes. RFC 3986 defines a narrow unreserved set (alphanumerics plus - . _ ~) and encodes spaces as %20, whereas HTML form submissions (application/x-www-form-urlencoded) encode spaces as +.

JavaScript's built-in encodeURIComponent() does not encode !, ', (, ), or *, which breaks strict RFC 3986 signature schemes. Furthermore, encoding a full URL with encodeURIComponent() corrupts scheme slashes (://) and query delimiters (? and &); always encode individual parameter keys and values rather than the entire URI.

  • RFC 3986 Unreserved SetOnly A–Z, a–z, 0–9, '-', '.', '_', and '~' remain unencoded in strict component mode.
  • JS encodeURIComponent GapStandard encodeURIComponent leaves ! ' ( ) * unencoded; RFC 3986 mode percent-encodes them (%21 %27 %28 %29 %2A).
  • Space Encoding ModesSupports %20 (RFC 3986 path & query) and + (WHATWG application/x-www-form-urlencoded).
Should a space in a URL be encoded as %20 or +?

In the URL path segment (/files/my%20doc.pdf), spaces must always be %20 because + is a literal plus sign in paths. Inside query strings (?q=hello+world), + is valid for application/x-www-form-urlencoded, though %20 works universally.

Why does decodeURIComponent throw URIError on some strings?

A bare % sign not followed by two valid hex digits (such as '50% off') or a malformed UTF-8 percent sequence causes decodeURIComponent() to throw URIError. This tool detects malformed escapes without crashing.

Why did my OAuth callback URL break after encoding?

Double-encoding turns %2F into %252F. Check whether your HTTP client library already percent-encodes query parameters before passing pre-encoded strings.