Build and Parse Query Strings Without the Headache
Query strings are how websites pass data between pages and APIs — search terms, filters, pagination, and tracking parameters all travel in that short text after the ?. The catch is that every special character must be percent-encoded correctly, and a single unencoded & or = silently breaks the whole parameter list. This tool removes that fragility: you add key-value pairs in a simple form, and it builds a properly encoded query string for you. It also parses existing URLs back into readable parameters, which makes debugging links and building API requests straightforward. Because everything runs in your browser, your data stays local.
How to Build a Query String
- Add a key-value pair, for example
qwith valuehello world. - Add more pairs for every parameter you need — search terms, page numbers, filters, and so on.
- Review the encoded output; spaces become
%20and reserved characters become their encoded forms. - Copy the generated string, or append it to your base URL with
?in front. - To parse, paste a full URL and the tool lists every parameter name and decoded value.
- Edit a parameter, rebuild, and compare the before and after strings for your tests.
Real Example: Input and Output
You are building a search link for a shop that filters by term and category. The tool takes the raw values and produces a string that will survive copy-paste into a browser or an API client.
| Input | Output |
|---|---|
q=hello world | q=hello%20world |
name=Tom & Jerry | name=Tom%20%26%20Jerry |
lang=en, page=2 | lang=en&page=2 |
Where Query Strings Appear
- Search pages — the term typed into a search box is carried in the query.
- API requests — GET endpoints accept filters and options as query parameters.
- Tracking campaigns — UTM parameters identify the source of a visit.
- Pagination —
pageandlimitparameters control which slice of results loads.
Tips for Best Results
- Encode reserved characters —
&,=,?, and#inside a value must be percent-encoded or they will be read as syntax. - Keep it short — most servers and proxies cap URLs around 2000 to 8000 characters; keep parameter values compact.
- Be consistent — use the same parameter names and encoding style across your app so parsing never surprises you.
- Never encode the whole URL — only the values inside the query need encoding; the
:and/in the scheme and path stay as they are.
Frequently Asked Questions
What is percent-encoding?
Percent-encoding replaces unsafe characters with a % followed by two hexadecimal digits representing the byte value. A space becomes %20 and & becomes %26, so the value survives transport unchanged.
Which characters must be encoded in a query string?
Reserved characters such as &, =, ?, #, and % itself must be encoded when they appear inside a value. Letters, digits, and a few safe symbols like - and _ can stay as they are.
Why do I sometimes see + instead of %20 for spaces?
HTML form encoding uses + for spaces, while URL standard encoding uses %20. Both are widely accepted, but %20 is safer because it works everywhere, including inside path segments.
How do I pass a literal ampersand inside a parameter value?
Encode it as %26. If you leave a raw &, the server treats it as the separator between two parameters and your value gets cut short.
Is there a maximum length for a URL?
There is no official limit, but practical ceilings exist: many servers reject URLs over 8000 characters, and older browsers cap out near 2000. Keep query strings as short as you can.
How do I pass an array or object in a query string?
Repeat the same key for each value, as in tag=a&tag=b, or encode the whole structure as JSON in a single percent-encoded value. The receiving framework usually documents which style it expects.
What is the difference between the query string and the fragment?
The query string after ? is sent to the server and affects the response. The fragment after # is client-side only and is never transmitted, so it cannot be read by the server.
Should I encode the entire URL before sending a request?
No. Encoding the whole URL turns : and / into %3A and %2F, which breaks the structure. Encode only the parameter names and values within the query section.