URL Encoder & Decoder Online

Percent-encode or decode URLs and query strings in real time — private, instant, no server required.

Function:

Enter a URL or text to percent-encode it.

Output length: 0 characters

What is URL Encoding?

URL encoding (also called percent-encoding) is a mechanism for encoding characters in a URI so they can be safely transmitted over the internet. RFC 3986 defines which characters are "unreserved" (allowed as-is) and which must be replaced with a % followed by two hexadecimal digits representing the character's UTF-8 byte value.

For example, a space character becomes %20, and an ampersand & in a query value becomes %26.

encodeURIComponent vs encodeURI

Function Encodes Does NOT encode Best for
encodeURIComponent Everything except A–Z a–z 0–9 - _ . ! ~ * ' ( ) Unreserved chars only Query parameter values, path segments, form data
encodeURI Characters not valid in a URI Preserves ; , / ? : @ & = + $ # Encoding a full URL while keeping its structure intact

In practice: use encodeURIComponent for individual parameter values (it encodes &, =, +), and use encodeURI when you want to encode a full URL without breaking its structure.

Common Use Cases

  • Query string parameters: Values in ?key=value pairs must be percent-encoded so that & and = inside values do not break the URL structure.
  • Internationalized URLs (IRI): Non-ASCII characters (Chinese, Arabic, accented letters) must be UTF-8 encoded then percent-encoded for use in standard URLs.
  • Form submission (application/x-www-form-urlencoded): HTML form data is encoded with spaces as + or %20 and special characters percent-encoded.
  • OAuth & API signatures: Many OAuth 1.0 and HMAC signing schemes require the full URL and parameters to be percent-encoded before computing the signature.
  • Redirects & deep links: When a URL is passed as a parameter inside another URL (e.g. ?redirect=https://...), it must be fully percent-encoded.
  • Debugging encoded URLs: Decode a percent-encoded URL from a log file or browser address bar to read it as plain text.

Percent Encoding Reference

Character Encoded Notes
Space%20Also written as + in form data
!%21encodeURIComponent only
#%23Fragment identifier — both functions
$%24encodeURIComponent only
&%26Query param separator — encodeURIComponent only
+%2BMeans space in form data — encodeURIComponent only
/%2FPath separator — encodeURIComponent only
:%3AScheme separator — encodeURIComponent only
=%3DKey=value separator — encodeURIComponent only
?%3FQuery string start — encodeURIComponent only
@%40User info separator — encodeURIComponent only

Frequently Asked Questions

Why is a space sometimes %20 and sometimes +?

In a standard URI (RFC 3986), a space is percent-encoded as %20. In HTML form data encoded as application/x-www-form-urlencoded, spaces are encoded as +. The two formats are not interchangeable — always decode with the same scheme that was used to encode.

What characters do NOT need to be encoded?

RFC 3986 defines "unreserved characters" that are safe in any URI component: uppercase and lowercase letters A–Z a–z, digits 0–9, and the four symbols - _ . ~. Everything else should be percent-encoded in parameter values.

When should I use encodeURI instead of encodeURIComponent?

Use encodeURI when you have a complete URL and want to make it safe without destroying its structure (preserving ://, /, ?, &, etc.). Use encodeURIComponent when you are building a URL and need to safely embed a value inside a query parameter — it encodes those structural characters so they cannot be misinterpreted.

Is double-encoding a problem?

Yes. If you encode an already-encoded string, the % signs themselves get encoded to %25, turning %20 into %2520. Always decode first if unsure whether the input is already encoded.

Does URL encoding affect the domain name?

Hostnames use a different mechanism called Punycode (IDN — Internationalized Domain Names) rather than percent-encoding. For example, the Chinese domain 中文.com becomes xn--fiq228c5hs.com in DNS. URL encoding only applies to the path, query string, and fragment parts of a URI.