What Is URL Encoding?

URL encoding (also called percent-encoding) converts special characters in URLs into a format that can be transmitted safely over the internet. Characters that aren't allowed in a URL are replaced with a percent sign (%) followed by two hexadecimal digits.

Why URLs Need Encoding

URLs may only contain a specific set of ASCII characters. Characters like spaces, accents, Chinese characters, and symbols like &, =, # have special meanings in URLs and must be encoded when used as data.

Common URL Encoding Examples

CharacterEncoded FormWhy It Needs Encoding
Space%20Spaces aren't valid in URLs
&%26Separates query parameters
=%3DSeparates key-value pairs
#%23Fragment identifier
+%2BAlternative for space in forms
中文%E4%B8%AD%E6%96%87Non-ASCII characters

encodeURI vs encodeURIComponent in JavaScript

  • encodeURI(url) — Encodes an entire URL, leaving structural characters (: / ? # &) intact.
  • encodeURIComponent(value) — Encodes a query parameter value, encoding & = # + etc. Use this for individual parameter values.
const search = "hello world & more";
encodeURIComponent(search); // "hello%20world%20%26%20more"

How to Encode/Decode URLs Online

  1. Open FavorTool URL Encoder.
  2. Paste the URL or query string value.
  3. Click Encode or Decode.
  4. Copy the result.