Query String Builder

Query string—
Pairs—
Length (characters)—

How Query String Builder is calculated: A query string is key=value pairs joined by &, with keys and values URL-encoded: name=Viv&city=Delhi&lang=en. A space becomes %20, a plus becomes %2B, and an ampersand becomes %26 — so a value can never be mistaken for a new pair.

What is a query string builder?

A query string builder turns a list of key-value pairs into the query string that goes at the end of a URL. Type name=Viv on one line, city=Delhi on the next, and lang=en on the third, and the builder gives you name=Viv&city=Delhi&lang=en — 27 characters, three pairs, ready to stick after a question mark on any link. The keys and values are URL-encoded as they go, so a space or an ampersand in a value cannot break the result.

The query string is the part of a URL after the question mark, and it is how a link carries data to a server. A search page reads it to know what to search for, a filter reads it to know what to filter by, and a tracking link reads it to know where the click came from. Every time you click a link with a question mark in it, you are sending a query string.

Building one by hand is easy to get wrong. Forget the ampersand and two pairs become one; leave a space raw and the link breaks; put an ampersand inside a value and it splits into two pairs you never meant. The builder does the joining and the encoding for you, so the string it gives you is correct by construction — and it shows the pair count and the length alongside, so you can check at a glance.

It runs entirely in your browser. Nothing is uploaded, nothing is stored, and there is no account to create. A query string is just text, and a builder has no business collecting it.

How a query string is built: keys, values, and encoding

The shape is simple. Each pair is a key, an equals sign, and a value: name=Viv. Pairs are joined by ampersands: name=Viv&city=Delhi&lang=en. The whole string goes after a question mark on a URL: https://example.com/page?name=Viv&city=Delhi&lang=en. The question mark is not part of the string the builder gives you — it is the separator between the path and the query, and the builder leaves it off so you can add it yourself.

The encoding is where the care lives. A URL cannot contain a raw space, a raw ampersand, or a raw plus sign inside a value, because each of those characters means something in a URL. So the builder encodes them: a space becomes %20, an ampersand becomes %26, a plus becomes %2B, and an at-sign becomes %40. The server decodes them back on arrival, so the value it sees is exactly the value you typed.

The default example shows the plain case: name=Viv, city=Delhi, lang=en — three pairs, no special characters, 27 characters in total. The encoding matters in the second example: q=hello world becomes q=hello%20world, because the space in 'hello world' must be encoded or the link would break at the space. With page=2 on the next line, the full string is q=hello%20world&page=2 — two pairs, 22 characters.

Blank lines are ignored, and lines without an equals sign are ignored too. That means you can paste a rough list — with gaps, with notes, with a line that is not a pair — and the builder will quietly skip the lines that are not pairs. A line with an equals sign in the value is fine: the builder splits on the first equals sign, so tag=a=b becomes the key 'tag' with the value 'a=b'.

The characters that must be encoded

Three characters cause most query-string trouble, and all three are handled by encoding. The space is the first: it becomes %20, because a raw space ends a URL in most places that read one. A search for 'hello world' is q=hello%20world, and a search for 'hello%20world' typed raw would search for the literal text 'hello%20world' — which is not the same thing at all.

The ampersand is the second, and it is the dangerous one. An ampersand joins pairs, so a value that contains one must be encoded as %26 — or the value splits. The pair tag=rock & roll, written raw as tag=rock & roll, would be read as the pair tag=rock, then a broken pair ' roll'. Encoded, it is tag=rock%20%26%20roll, and the server sees the value 'rock & roll' whole. That single encoding is the difference between a value that arrives intact and one that arrives in pieces.

The plus sign is the third, and it is the subtle one. In a query string, a plus is often read as a space by the server — so the value 'a+b' sent raw would arrive as 'a b'. The builder encodes it as %2B, and the server decodes %2B back to a plus. The pair email=a+b@c.com becomes email=a%2Bb%40c.com, and the address arrives with its plus and its at-sign exactly as typed.

A few characters are left alone by design: letters, digits, and - _ . ! ~ * ' ( ) are never encoded, because they are safe in a URL as they are. Everything else — spaces, punctuation, non-English letters — is encoded. If a value looks strange in the output, it is usually one of these characters doing its job. An URL encoder-decoder encodes a single value the same way, if you need to check one value on its own.

A worked example: three pairs, one query string

Take the default input exactly as it sits on the page: name=Viv, city=Delhi, lang=en, one pair per line. The builder gives you name=Viv&city=Delhi&lang=en — three pairs, 27 characters. Stick a question mark in front and a path before that, and you have a complete link: https://example.com/page?name=Viv&city=Delhi&lang=en.

Now try a value with a space. Two lines: q=hello world and page=2. The builder gives you q=hello%20world&page=2 — two pairs, 22 characters. The space became %20, the pairs are joined by one ampersand, and nothing else changed. Paste that after a question mark and the server will search for 'hello world' and show page 2.

A third case shows the blank-line rule. Three lines: a=1, a blank line, and b=2. The builder gives you a=1&b=2 — two pairs, 7 characters. The blank line vanished, because it is not a pair. That is useful when you paste a list out of a spreadsheet or a note, where blank lines are common and should not become empty pairs.

A fourth case shows the tricky characters together. Two lines: email=a+b@c.com and tag=rock & roll. The builder gives you email=a%2Bb%40c.com&tag=rock%20%26%20roll — two pairs, 41 characters. The plus became %2B, the at-sign became %40, the spaces became %20, and the ampersand became %26. Read it back and every value is exactly what was typed — which is the whole point of encoding.

Who builds query strings, and why

Web developers build query strings whenever a link has to carry data. A search box, a filter, a sort order, a page number — all of them travel as query strings. A developer building a link by hand will type the pairs into a builder, copy the string out, and paste it into the code, because a hand-typed query string with a missing ampersand is a bug that takes an hour to find.

Marketers build them for tracking. A campaign link carries utm_source, utm_medium, and utm_campaign — three pairs that tell the analytics tool where the click came from. A link shared in a newsletter carries utm_source=newsletter, and the same link shared on social media carries utm_source=social. The builder makes those links correctly, and the analytics stay clean.

Testers build them to check an API. An API that takes filters as query parameters — status=active, sort=date, page=2 — needs a correct string for every test, and a builder gives it in seconds. A JSON formatter tidies the API's answer, while this builder tidies the question.

Then there are the everyday uses: a link to a map with a place already searched, a link to a shop with a filter already set, a link to a document with a page already open. Any link that opens a page already set up the way you want it is carrying a query string, and a builder is the fastest way to write one that works.

Query string builder vs URL encoder-decoder

A query string builder and a URL encoder-decoder are neighbours that do different jobs. The builder takes a list of pairs and produces a whole query string, joining and encoding as it goes. The URL encoder-decoder takes one value and encodes or decodes it on its own. One builds the string, the other fixes a single value inside it.

Use the builder when you have several pairs and want the finished string. Use the encoder-decoder when you have one value and want to see what it looks like encoded — or when you have an encoded value in a link and want to read it back. The builder is for writing; the encoder-decoder is for reading and checking.

They agree with each other, because they use the same encoding. The builder encodes 'hello world' as hello%20world, and the encoder-decoder does the same. If the builder's output ever looks wrong, paste the suspicious value into the encoder-decoder and check it alone — the fault is usually one character, and seeing it alone makes it obvious.

One more neighbour: the Base64 encoder-decoder encodes data in a different way, for a different job — putting binary data into text, not putting text into a URL. Do not use Base64 where a query string belongs: a server reading a query string expects percent-encoding, and Base64 in a query value is a different thing entirely.

Common query string mistakes

The most common mistake is a raw ampersand inside a value. A value like 'rock & roll' written raw splits into two pairs, and the second half is read as a broken key. Encode it — %26 — and the value arrives whole. This is the single most common query-string bug, and the builder exists to stop it happening.

Second: a raw space. A space in a value must become %20, or the link breaks at the space. A search for 'hello world' is q=hello%20world, and anything else is a broken link. Third: a raw plus sign. A plus in a query string is read as a space by many servers, so 'a+b' arrives as 'a b' unless it is encoded as %2B.

Fourth: putting the question mark in twice. The builder's output has no leading question mark, because the question mark belongs between the path and the query. A link written as page??name=Viv has two question marks, and the server reads the second one as part of a key. Add one question mark, once, between the path and the string.

Fifth: case. Keys are case-sensitive — 'Search' and 'search' are different keys, and a server that expects 'search' will ignore 'Search' without an error. If a filter or a search is silently not working, check the capitalisation of the key before anything else. And sixth: assuming order matters. For most servers it does not, but for signed links — where the string is hashed to prove it was not tampered with — the order is part of the signature, and changing it breaks the check.

How to use this query string builder

Using it takes a few seconds. Type your pairs one per line, in key=value form — the default is name=Viv, city=Delhi, lang=en. The query string appears instantly in the box below, with the pair count and the length above it. Copy it from the output box and paste it after a question mark on your link.

To check a value with a tricky character, type it and watch the output: a space becomes %20, a plus becomes %2B, an ampersand becomes %26, and an at-sign becomes %40. If the output shows a character you did not expect, it is the encoding doing its job — the server will decode it back on arrival.

Everything runs in your browser, so nothing you type is uploaded or stored. One practical tip: build the string, then paste the whole link into a fresh browser tab and check the page does what you expect. A query string that looks right but points at the wrong filter is a silent bug — the page loads, the data is wrong, and nobody notices until much later.

And if you only need to encode one value, or decode one you found in a link, the URL encoder-decoder does that one value on its own. The builder is for the whole string; the encoder-decoder is for a single piece of it.

Frequently Asked Questions

The part of a URL after the question mark, made of key=value pairs joined by ampersands — for example name=Viv&city=Delhi&lang=en. It carries data to the server: a search term, a filter, a page number, or tracking information. The question mark itself is the separator between the path and the query, not part of the string.

Because a URL cannot contain a raw space — it would end the link wherever it appears. Encoding turns the space into %20, which the server decodes back to a space on arrival. A search for 'hello world' is written q=hello%20world, and the server searches for 'hello world', not for 'hello%20world'.

Because an ampersand joins pairs, so a raw ampersand inside a value splits it. The value 'rock & roll' written raw becomes the pair tag=rock plus a broken piece ' roll'. Encoded as %26, it stays one value: tag=rock%20%26%20roll, and the server sees 'rock & roll' whole.

For most servers, no — name=Viv&city=Delhi and city=Delhi&name=Viv mean the same thing. The exception is signed links, where the string is hashed to prove it was not tampered with: there, the order is part of the signature, and changing it breaks the check. If a signed link fails, check the order first.

More free tools

More calculators and utilities from Sortrun — free, no sign-up.