Query-String Parser / Builder
A URL query string is the part of a URL that comes after ?.
It carries parameters as key=value pairs separated by &, for example:
?q=hello%20world&tag=a&tag=b.
This tool converts between a query string (or full URL) and a structured key–value table,
and it can rebuild a clean query string from that table.
Standards: The syntax of URIs and percent-encoding follows RFC 3986.
In the browser, component encoding commonly follows encodeURIComponent conventions.
How query strings are structured
- Separator: pairs are separated by
&.
- Assignment: within a pair, key and value are separated by the first
=.
- Empty value:
flag= means key = flag with an empty value.
- Missing “=”:
flag is treated as key = flag, value = empty.
- Duplicates: keys may repeat:
tag=a&tag=b.
Important: The query string ends before a fragment marker #.
Anything after # is not part of the query and is ignored by the parser.
Encoding and decoding (percent-encoding)
URLs use percent-encoding to represent characters that are not safe to write directly.
A percent-encoded byte looks like % followed by two hexadecimal digits (example: %2F for /).
Two common conventions in the tool
-
RFC3986 percent-decoding: decode
%XX sequences using standard URI rules.
-
Form encoding (“+ as space”): treat
+ as a space before percent-decoding.
This is common for HTML form submission and many backends.
Space choice when building: you can encode spaces as %20 (RFC style) or as + (form style).
Parse mode: URL/query → table
-
Normalize input:
- If a full URL is pasted, the tool extracts everything after the first
?.
- If a
# fragment is present, it is removed and a warning is shown.
- Leading
? or stray leading & are tolerated, but may produce warnings.
-
Split into pairs by
&.
-
Split key and value on the first
=.
Any additional = characters remain part of the value.
-
Decode key and value using the selected decode mode (RFC3986 or form mode).
-
Populate the table, keeping duplicate keys as separate rows.
Warnings you may see: invalid percent sequences (a % not followed by two hex digits),
empty keys (=value), stray ? inside the query body, or trailing/leading &.
Build mode: table → query / full URL
-
Read the key–value rows from the editable table (empty rows are ignored).
-
Handle duplicates according to your choice:
- Keep duplicates: output repeated keys like
tag=a&tag=b.
- Merge duplicates: combine values into a single key using commas (example:
tag=a,b).
-
Optional key sorting: reorder pairs by key for a stable, predictable output.
-
Encode each component:
keys and values are encoded separately (similar to
encodeURIComponent),
then joined as encodedKey=encodedValue.
-
Join pairs using
& and produce:
- The query string output (
?...).
- The full URL preview (base URL + query), if a base URL is provided.
Preview logic: If the base URL already contains ?, the tool appends using &;
otherwise it uses ?.
The visualization: encoded vs decoded split-pane
The split-pane preview helps you see what changed during encoding/decoding:
- Left pane shows the raw/encoded text and highlights percent sequences like
%2F.
- Right pane shows the decoded preview, highlighting spaces that may come from
%20 or +.
- Invalid percent sequences are highlighted separately, and warnings list their positions.
The preview is educational: it highlights the most important encoding/decoding changes, especially percent sequences and spaces.
Inputs and outputs summary
Practical tips
- If the URL came from a form submission, try Form encoding (+ as space).
- If you want a standards-first URL, prefer spaces as %20 and avoid merging duplicates unless your API expects it.
- Duplicate keys are common for filters (tags, categories). Keep duplicates when the server expects repeated keys.
- When warnings appear, check the left pane for red-highlighted percent sequences (malformed encodings).
Safety note: The tool does not navigate to URLs or make network requests. It only parses and formats text locally in your browser.