URL Encoding, Percent-Encoding and Query Strings: What Actually Matters
When spaces become %20 or +, the difference between encodeURI and encodeURIComponent, double-encoding bugs and how to debug URLs component by component.
URL encoding bugs hide in plain sight: a plus sign that becomes a space, a slash that cuts a parameter short, a mailto link that breaks in exactly one mail client. The rules fit in one article — and a habit of checking.
What percent-encoding actually is
A URL can only carry a limited set of characters safely. Everything else — space, accents, Emoji, a literal slash inside a value — becomes %XX byte sequences. A space is %20; a plus sign in a query value is %2B, because in application/x-www-form-urlencoded space is written as a literal +.
encodeURI vs encodeURIComponent
- encodeURI keeps URL structure (/ ? & #) — for encoding a complete address.
- encodeURIComponent escapes structure too — for encoding a value that will live inside another URL.
Using the wrong one is the classic bug: full URLs pasted as parameter values without component encoding lose everything after the inner query. The URL Encoder & Decoder has both modes with the per-character mapping shown.
Double-encoding and its twin
Sent through two encoders, a value turns %20 into %2520. Decode repeatedly in the tool until changes stop — that reveals how many layers the data passed through, and which layer dropped it. Equally common: decoding once at a layer that should not decode at all.
Parsing beats guessing
When a URL misbehaves, inspect it structurally instead of staring at the string. The URL Parser splits protocol, host, path, each query key-value pair and the fragment, decoding each parameter individually per WHATWG rules — the same rules browsers apply, so what you see is what routing code gets.
Related guides
Testing Regular Expressions Safely in Your Browser
A practical regex testing workflow: flags, capture groups and lookarounds visualized, catastrophic backtracking awareness, and why browser testers protect your patterns.
Read guide →2026-09-30QR Codes: Size, Error Correction and Payload Limits Explained
How QR codes pack data: versions, the four error correction levels, scan distance rules and the payload ceiling — plus what makes a code unscannable.
Read guide →2026-09-18camelCase, snake_case and kebab-case: A Field Guide to Naming Conventions
Which naming convention belongs where across languages, URLs and APIs; case conversion pitfalls with acronyms; and why consistency beats preference.
Read guide →Try these tools
URL Encoder / Decoder
Percent-encode or decode URLs and query components instantly. Component or full-URL mode, live size stats, strict position-accurate error reporting — all offline in your browser.
Open tool →URL Parser
Paste any URL and see protocol, host, port, path, hash and every query parameter in a clean table. Relative URLs are resolved against a configurable base. Nothing is sent anywhere.
Open tool →