About this tool
Concatenating strings to build URLs breaks as soon as a value contains &, =, #, a space or a non-English character. This builder percent-encodes every key and value correctly, supports the array conventions different backends expect, and previews the full URL. Enter one key=value per line, or paste a JSON object; nested objects become bracket keys like filter[brand].
Array formats
| Format | Example | Used by |
|---|---|---|
| Repeat | size=9&size=10 | Go, Python, Java, URLSearchParams.getAll |
| Brackets | size[]=9&size[]=10 | PHP, Rails, Node qs |
| Comma | size=9,10 | Many REST APIs and OpenAPI’s default form style without explode |
| Index | size[0]=9&size[1]=10 | Some PHP and .NET model binders |
In code
// JavaScript
const url = new URL('https://shop.example.com/search');
url.searchParams.set('q', 'running shoes & socks');
url.searchParams.append('size', '9');
url.toString(); // …?q=running+shoes+%26+socks&size=9
# Python
from urllib.parse import urlencode
urlencode({"q": "running shoes & socks", "size": [9, 10]}, doseq=True)
FAQ
How do I build a query string?
Enter one key=value pair per line (or paste JSON) above. Each key and value is encoded and joined with &, and the full URL is shown below.
How do I pass an array in a query string?
It depends on your server: repeated keys (a=1&a=2) are most widely understood; PHP and Rails expect a[]=1&a[]=2. Pick the format above.
Should spaces be + or %20?
Both are decoded as spaces in query strings by almost all servers. + is the HTML form convention; %20 is the general URL encoding.