Web & HTTP

Query String Builder: Build URL Query Strings from Key-Value Pairs

Construct valid, properly encoded URL query strings from key-value pairs. Add, edit, and remove parameters with instant URL preview.

Published January 15, 2025Updated June 1, 20254 min read

Try the free online tool

Runs entirely in your browser — no signup, no uploads.

Open Tool

Building a URL query string by hand is surprisingly easy to get wrong. Forget to encode a space or a special character, and the URL breaks or passes along incorrect data. Add an extra `&` or misplace a `=`, and the server may misinterpret your parameters entirely. For developers constructing URLs dynamically — for API calls, redirects, or sharing links — getting the encoding exactly right is critical.

This tool simplifies the process by letting you enter key-value pairs through a friendly form interface. It handles all the percent-encoding automatically, joining your parameters with `&` and building a correctly formatted query string and full URL in real time. No more manually typing `%20` or worrying about which characters need escaping.

Whether you're crafting a URL to share with a colleague, building a test request, or generating a query string for use in code, this tool saves time and eliminates encoding mistakes.

What Is a Query String Builder?

A query string builder is a tool that takes a set of named parameters and their values and combines them into a properly formatted, URL-encoded query string. The output is a string like `?key1=value1&key2=value2` that can be appended to a base URL.

Manually constructing query strings is tedious and error-prone. Values containing spaces, ampersands, equals signs, non-ASCII characters, or other special characters must be percent-encoded — a process that's easy to forget or do incorrectly. A builder automates this, ensuring every value is safe for use in a URL.

Query string builders are commonly used when constructing URLs for API requests, email marketing links with UTM parameters, filtered search pages, or any other scenario where dynamic parameters need to be embedded in a URL.

How to Use This Tool

Add your parameters and get a ready-to-use query string instantly.

  1. 1

    Enter a base URL (optional)

    Provide a base URL such as https://example.com/search if you want the tool to output a complete URL, or leave it blank to get just the query string.

  2. 2

    Add key-value pairs

    Click 'Add Parameter' and enter a key and value for each query parameter you want to include.

  3. 3

    Review the live preview

    The tool instantly updates the query string preview as you type, showing you exactly what will be generated.

  4. 4

    Edit or remove parameters

    Use the edit and delete buttons on each row to adjust parameters without retyping the entire string.

  5. 5

    Copy the result

    Click the copy button to copy the final URL or query string to your clipboard, ready to paste into your code or browser.

Common Use Cases

Building query strings is a common need across web development, marketing, and API work.

  • Generating UTM-tagged marketing URLs — adding utm_source, utm_medium, and utm_campaign parameters to links for analytics tracking.
  • Constructing API request URLs — building parameterized endpoint URLs for testing in a browser or documentation.
  • Creating share links with pre-filled state — encoding filter values, search terms, or selected options into a shareable URL.
  • Testing form submissions — crafting GET request URLs that simulate what a form would submit to verify server behavior.
  • Building pagination links — constructing URLs with page, limit, and offset parameters for navigating paginated data sets.

Tips and Best Practices

Follow these tips to build clean, reliable query strings.

  • Always encode values — never concatenate raw user input directly into a URL; use a builder or the language's built-in URL encoding functions.
  • Keep parameter names lowercase and use underscores or hyphens for readability and consistency across your application.
  • Avoid putting sensitive data in query strings — they appear in browser history, server logs, and HTTP Referer headers.
  • Use arrays carefully — if your server expects `ids[]=1&ids[]=2`, confirm the exact array syntax your framework requires.
  • Test with edge-case values like empty strings, long values, and Unicode characters to ensure your URLs are handled correctly end-to-end.

Frequently Asked Questions

Does the tool automatically encode special characters?

Yes. The builder percent-encodes all values that contain characters unsafe in URLs — including spaces, ampersands, equals signs, and non-ASCII characters — so you don't need to do it manually.

Can I add a parameter with an empty value?

Yes. Leave the value field blank and the tool will include the key with an empty string value, outputting something like `?verbose=`. This is valid in HTTP and useful for flag-style parameters.

What encoding standard does this tool use?

The tool follows RFC 3986 percent-encoding, which is the standard for encoding URI components. This is the same standard used by `encodeURIComponent` in JavaScript and `urllib.parse.urlencode` in Python.

Can I add the same key multiple times?

Yes. You can add the same key with different values to represent array-style parameters, such as `?tag=js&tag=css`. Use this when your server expects repeated parameters instead of a bracketed array syntax.

How do I use this output in JavaScript?

You can paste the generated query string directly into a `fetch` or `XMLHttpRequest` call, or use it as the input to `new URL()`. Alternatively, use `URLSearchParams` in JavaScript to build query strings programmatically.

Does the order of parameters matter?

HTTP does not define a required order for query parameters, and most servers treat them as unordered. However, some systems or caching layers may treat differently ordered query strings as different URLs, so consistency is good practice.

urlquery stringurl encodingquery parametersweb

Ready to use this tool?

Free, instant, no account required. Runs entirely in your browser.

Open Tool

More Web & HTTP Guides