Favorites

Dev Tools

InoTools Blog
Category:Tutorial

What is URL Encoding? A Guide to Percent-Encoding

Ever seen %20 or %E6%9D%B1 in URLs? That's URL encoding in action. Learn how it works and how to encode or decode URLs safely.

What is URL Encoding?

URL encoding (percent-encoding) converts characters that aren't allowed in URLs into %XX (hexadecimal) format. It's defined by the URI specification in RFC 3986.

For example:

  • Space → %20
  • &%26
  • cafécaf%C3%A9
  • naïvena%C3%AFve

Only alphanumeric characters (A-Z, a-z, 0-9) and a few symbols (-, _, ., ~) are safe in URLs. Everything else must be encoded.

Why Is URL Encoding Needed?

URLs have strict rules about which characters are allowed. Without encoding:

  • Data corruption — Non-ASCII characters aren't transmitted correctly to servers
  • Parameter breakage& and = are misinterpreted as query parameter delimiters
  • Security risks — Unintended parameter injection or XSS attacks become possible

Where URL Encoding Is Used

  • Search queries — Including non-ASCII characters in search URLs
  • Form submission — Sending HTML form data (application/x-www-form-urlencoded) to servers
  • API calls — Building query parameters for RESTful APIs
  • Redirects — Safely embedding destination URLs as parameters
  • Cookies — Escaping special characters in cookie values
  • Email links — Subject and body in mailto: links

Benefits of URL Encoding

  • Internationalization — Safely include characters from any language (Japanese, Chinese, Arabic, etc.) in URLs
  • Data integrity — Treat reserved characters (?, &, =, #) as literal data
  • Standards compliant — Based on RFC 3986, producing consistent results across all browsers and servers
  • Security — Reduces risk of parameter injection and XSS attacks

How to Encode/Decode URLs

URL encoding and decoding is easy with our URL Encoder / Decoder. All processing happens entirely in your browser—your data is never sent to any external server. Free with no registration required.

Encode/Decode URLs instantly

How to Use the Tool

  1. Open the URL Encoder / Decoder
  2. Select encode or decode mode
  3. Enter text or a URL
  4. The converted result appears in real-time
  5. Copy the result for use

Frequently Asked Questions

Q. What's the difference between encodeURI and encodeURIComponent?

A. encodeURI() encodes a full URL while preserving structural characters like ://, ?, and &. encodeURIComponent() is meant for encoding parameter values and encodes those characters too. Use encodeURIComponent() for parameter values.

Q. Does URL encoding affect SEO?

A. Google handles encoded URLs correctly, so there's no negative SEO impact. However, for readability when sharing on social media, consider using URL shorteners for very long encoded URLs.

Q. What's the difference between + and %20?

A. Both represent a space, but + is used in application/x-www-form-urlencoded (form submissions), while %20 is the standard in the URI specification (RFC 3986). For API query parameters, %20 is recommended.

Related Terms

  • Percent-Encoding — The formal name for URL encoding. Characters represented in %XX format
  • RFC 3986 — International standard defining URI syntax
  • Query Parameterskey=value data pairs after ? in URLs
  • URI (Uniform Resource Identifier) — A string that uniquely identifies a resource. URLs are a type of URI
  • UTF-8 — The character encoding used in URL encoding