Online URL Params Parser: Extract and Analyze URL Query Parameters
What Are URL Parameters
URL parameters (Query Parameters) are key-value pairs after the ? in a URL, used to pass additional information. Multiple parameters are separated by &.
URL Structure
https://example.com/search?q=javascript&page=1&lang=zh
|____________ Base URL ____________| |___ Query Params ___|
^ ^
? &
URL Encoding
Special characters in URLs need encoding — an online URL encoder handles this in one click:
- Space →
%20or+ - Chinese →
%E4%B8%AD%E6%96%87 &→%26=→%3D
Why You Need URL Parameter Parsing
- API debugging: Analyze query parameters in API requests
- SEO analysis: Check tracking parameters (utm_source, etc.)
- Parameter extraction: Quickly extract key info from long URLs
- URL cleanup: Remove unwanted parameters
- Redirect analysis: Analyze parameters in redirect URLs
- Link sharing: Strip tracking parameters from URLs
Common URL Parameters
| Parameter | Description | Example |
|---|---|---|
q | Search query | ?q=javascript |
page | Page number | ?page=2 |
sort | Sort order | ?sort=price_asc |
lang | Language | ?lang=zh |
utm_source | Traffic source | ?utm_source=google |
token | Auth token | ?token=abc123 |
callback | JSONP callback | ?callback=handleData |
How to Use an Online Tool
Using ToolVault's URL Params Parser:
- Paste a full URL (must include
http://orhttps://— the tool usesnew URL(), so a bare?a=1&b=2fails) - Click parse; parameters become an editable key/value table
- Add, edit, or remove rows — the rebuilt URL updates below
- Copy the result
For protocol, host, port, path, and hash as well, use the URL Parser (parses as you type, no button).
Implementer's note
Parse path: new URL(urlInput) + URLSearchParams(url.search), then forEach into the table — duplicate keys are kept as multiple rows (not last-wins only). Decoding follows WHATWG query rules: hello+world → hello world, %2B → literal +.
Rebuild path: searchParams.append for every non-empty key, then toString(). Important edges:
URLSearchParams.toString()writes spaces as+(form-urlencoded habit), while this site's URL encoder usesencodeURIComponentand writes%20— same meaning, different on-the-wire bytes; canonicalize before signature compares.- The table shows decoded values; type Chinese,
&, or spaces directly into value cells — encoding is applied on rebuild. - When a value is itself a URL (OAuth
redirect_uri), paste it as one value and let the tool encode once to avoid hand-rolled double encoding.
Percent-encoding fundamentals: URL encoder guide. Chinese %XX: Chinese URL encoding.
Duplicate keys, undefined, and empty: the three ambiguity cases
?tag=a&tag=b — URLSearchParams.get returns the last; getAll returns all; some backends keep the first. ?flag (no equals) and ?flag= both yield empty string under WHATWG, distinct from "key absent". Document which representation your API accepts, reject duplicates with 400 rather than silently choosing, and test the three cases. Our parser shows every duplicate — the tooling exists because the ambiguities are real.
Encoding round-trips and signatures
A parsed value that gets re-encoded must survive: %2B decodes to + and usually re-encodes as %2B via URLSearchParams; bare + decodes to space and re-encodes as +. Signature schemes must sort keys and apply one encoding before signing, or the round-trip changes bytes and verification fails. The parser's job is decoding once; the bug is always zero or two times. Pair with the HMAC tool; when the payload is JSON, inspect it in the JSON formatter first.
Security: parameter keys you must never trust
Three parameter-borne attacks: redirect / next / returnUrl accepting off-site URLs (open redirect — allowlist paths); callback / jsonp reflecting into script context (legacy XSS); parameter pollution reaching internal calls (?role=admin forwarded downstream). Treat every incoming parameter as untrusted at each new context boundary (SQL, HTML, URL, internal API).
URL Parameter Handling in Code
JavaScript
function parseUrlParams(url) {
const params = new URL(url).searchParams;
const result = {};
for (const key of new Set(params.keys())) {
const all = params.getAll(key);
result[key] = all.length > 1 ? all : all[0];
}
return result;
}
function buildUrl(base, params) {
const url = new URL(base);
Object.entries(params).forEach(([key, value]) => {
url.searchParams.set(key, value);
});
return url.toString();
}
function cleanUrl(url) {
const u = new URL(url);
['utm_source', 'utm_medium', 'utm_campaign', 'utm_content', 'utm_term', 'fbclid']
.forEach(param => u.searchParams.delete(param));
return u.toString();
}
Python
from urllib.parse import urlparse, parse_qs, urlencode
def parse_url_params(url):
parsed = urlparse(url)
return parse_qs(parsed.query) # keeps lists by default
def build_url(base, params):
return f"{base}?{urlencode(params)}"
def clean_url(url):
parsed = urlparse(url)
params = parse_qs(parsed.query)
clean_params = {k: v for k, v in params.items()
if not k.startswith('utm_') and k != 'fbclid'}
return f"{parsed.scheme}://{parsed.netloc}{parsed.path}?{urlencode(clean_params, doseq=True)}"
URL Parameter Security Notes
- Never put secrets in URLs (passwords, tokens) — they land in history and logs
- Proxies / CDNs may cache parameterized URLs
- Prefer POST body for sensitive data
- Set an appropriate Referer policy to limit leakage
- If a JWT appears in the query, prefer the Authorization header; for temporary inspection use the JWT decoder (never paste production tokens into untrusted environments)
Duplicate keys and empty values
Real query strings are messier than ?a=1&b=2:
| Shape | URLSearchParams behavior | Why it matters |
|---|---|---|
?tag=a&tag=b | get → first; getAll → both | Frameworks that only call get silently drop filters |
?flag / ?flag= | empty string value | Boolean flags vs “unset” differ by framework |
?q=+ vs ?q=%20 | both become space | Encoding round-trips must stay consistent |
?q=%2B | literal + | Needed when + is data, not a space |
The URL Params Parser lists every pair so duplicates are visible — use it before rewriting tracking params or debugging “half my filters disappeared.”
Rewriting without breaking signatures
When you strip utm_* or reorder keys for canonical URLs, remember signed query strings (CDN tokens, some OAuth flows) hash a specific order and encoding. Decode → edit → re-encode with the same rules the signer used, or verify against the signer’s docs. Blind URLSearchParams.toString() can change + vs %20 and invalidate a signature that still “looks” identical in the browser.
FAQ
Why Do URL Parameters Appear Garbled?
Non-ASCII characters need percent-encoding. Inconsistent encoding causes garbled output — cross-check with the URL encoder and stick to UTF-8.
How to Get URL Parameters in Frontend?
const params = new URLSearchParams(window.location.search);
const q = params.get('q');
const tags = params.getAll('tag'); // duplicates
Is There a URL Parameter Length Limit?
No single hard limit, but browsers and servers enforce their own (Chrome ~2MB, Apache default ~8190, Nginx default ~4096). Keeping total URL length under 2048 characters is a practical target.
Can I paste only ?a=1&b=2?
This tool's parse entry is new URL(), which needs a scheme and host. Prefix a dummy origin (https://example.com/?a=1&b=2) or use new URLSearchParams('a=1&b=2') in code.
Provided by ToolVault. Related tools: URL Params Parser, URL Parser, URL Encode/Decode, Base64, JWT Decoder. Visit the home page for more developer tools.
Related Tools
Related Articles
Markdown to Word: Native Style Mapping and the Inline-Format Downgrade List
Turning a Markdown draft into a deliverable .docx: pandoc CLI vs in-browser local conversion, how headings/tables/code blocks map to native Word styles, which inline formats degrade to plain text, and why 'editable' beats 'looks right'.
Word to Markdown: Two Clean Paths and What Survives the Conversion
How to convert .docx to Markdown cleanly: pandoc CLI vs in-browser local conversion, a format fidelity table for headings/tables/images/auto-numbering, and fixes for the .doc legacy format, image bloat, and merged-cell tables.
China License Plate Rules and Validation: Standard, New Energy, and Special Formats Explained
Mainland China plate encoding rules in full: the standard blue plate, the GA36D-2018 new-energy format, armed police and embassy plates, province abbreviations and issuing-authority letters — with an online validator.