What is URL percent-encoding?
URLs may only contain a limited set of characters. Anything outside that set — spaces, accented letters like the é in "café", ampersands, or Cyrillic characters such as those in "Майами" — must be percent-encoded: each byte is written as a % followed by two hexadecimal digits. A space becomes %20, and "café" becomes caf%C3%A9 in UTF-8. Decoding simply reverses that.
Component vs. full URL — which scope do I pick?
This matters, and getting it wrong is a common tracking bug.
- Component uses
encodeURIComponent. It escapes reserved characters like&,=,?,/and#. Use it when you are encoding a single piece of a URL — most often a query-string value, such as a search term or a UTM parameter. - Full URL uses
encodeURI. It leaves the reserved characters that give a URL its structure alone, sohttps://, the?and the&separators survive. Use it when you want to clean up an entire address without breaking it apart.
When to encode a URL
- Building tracking links where a parameter value contains spaces,
&, or non-ASCII text. - Passing one URL as a parameter inside another (a redirect or share link).
- Debugging a Miami landing page whose query string arrives garbled in analytics.
- Auditing crawl exports where paths appear double-encoded (
%2520instead of%20).
Encode each parameter value on its own with Component scope, then join them with & and =. If you encode the entire query string at once, those separators get escaped too and the URL stops working.
Encoding and decoding are quick wins, but they are one small part of technical SEO. See our full SEO services or browse every free utility in the Miami SEO tools library.