How to use the Query String Encoder
Encode a query string in three steps:
1
Choose input format and paste
Select 'JSON object' or 'key=value lines'. For JSON, paste a valid JSON object. For key=value, paste one key=value pair per line.
2
Set encoding options
In JSON mode, choose how arrays are encoded: repeated keys, bracket notation, or comma-separated. Toggle the ? prefix if needed.
3
Copy the query string
Click 'Encode Query String' and copy the output. The footer shows total character count and parameter count.
When to use this tool
Use to convert structured data into URL query strings for APIs and HTTP requests:
- →Converting a JavaScript object or API request body object to a query string for a GET request
- →Turning a list of filter parameters from a configuration file into a URL query string for testing
- →Building a query string from a set of key=value pairs copied from documentation or a Postman collection
- →Generating different array encoding formats to match the convention required by a specific API (Rails, PHP, etc.)
- →Converting JSON API parameters to query string format for use in a curl command or HTTP client
- →Creating encoded query strings for URL shorteners, redirect URLs, or shareable application state links
Frequently asked questions
Q:What is the difference between the three array encoding modes?
Repeated keys (key=a&key=b) is the most widely compatible format — PHP's $_GET, Node.js's querystring, and URLSearchParams all handle it. Bracket notation (key[]=a&key[]=b) is the convention used by Rails, PHP when using array syntax, and some JavaScript libraries like qs and axios. Comma-separated (key=a,b) is used by some APIs (notably Google APIs) as a compact alternative. Check your API's documentation to determine which format it expects.
Q:What JSON types are supported as values?
All JSON primitive types are supported: strings (encoded as-is), numbers (converted to string), booleans (encoded as 'true' or 'false'), and null/undefined (skipped — null values are not included in the query string). Arrays are encoded using the selected array mode. Nested objects are encoded using bracket notation (key[subkey]=value), which is the standard convention for serialising nested structures in query strings.
Q:Can I use this to encode form data for a POST request?
Yes — the output is a properly percent-encoded query string in application/x-www-form-urlencoded format, which is exactly the body format for HTML form POST submissions and many API requests. Set Content-Type: application/x-www-form-urlencoded in your request, disable the ? prefix (you don't want it in a request body), and use the output directly as the request body.
Q:How does the key=value input mode work?
In key=value mode, paste one key=value pair per line. The text before the first = on each line is the key; everything after the first = is the value (so values can contain = signs). Lines without an = sign are treated as keys with empty values. Values are automatically percent-encoded when building the query string — you can paste raw unencoded values and they will be encoded correctly.
Q:What happens to special characters in JSON values?
All key and value content is passed through encodeURIComponent before being assembled into the query string. Spaces become %20, ampersands become %26, equals signs become %3D, and Unicode characters are UTF-8 encoded. This means you can paste raw values with any characters in the JSON — the encoder handles the escaping. The only exception is that null values are excluded from the output.
Q:How is this different from the URL Builder tool?
The Query String Encoder focuses specifically on converting structured data (JSON or key=value text) into a query string in bulk. The URL Builder is an interactive form where you add parameters one row at a time and get a complete URL including protocol, hostname, and path. Use the Query String Encoder when you already have structured data to convert; use the URL Builder when constructing a URL from scratch with a visual row editor.