Handling Special Characters in Query Strings (The Right Way)

Query strings are full of landmines: spaces become +, & separates parameters, # starts fragments. Get one wrong and your data disappears silently.

Common Characters & Their Fate

  • Space → %20 (preferred) or + (only in application/x-www-form-urlencoded)
  • & → %26 (must be encoded or it splits parameters)
  • = → %3D (must be encoded in values)
  • ? → %3F (only if inside a value)
  • Emoji → encoded as UTF-8 bytes → %F0%9F%98%8A
  • Non-Latin (中文, عربي) → percent-encoded UTF-8

Never Do This

Manually replacing space with + in URLs (unless you’re building form-encoded bodies). Modern servers treat + as space only in form posts — not in regular query strings.

Pro Tips

Always encode user input with encodeURIComponent(). Never pre-process with replace(" ","+"). Let the browser/runtime do it correctly.

FAQ

Can I keep + as space in URLs?

Only if the server explicitly supports it (most don’t in 2025). Use %20 instead.

Are emojis safe in URLs?

Yes when properly encoded. This tool handles them perfectly.

Paste any text — even emojis and CJK — and see the correct encoding instantly.