Skip to content
Utilities2026-05-065 min read

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 → %20 or +
  • Chinese → %E4%B8%AD%E6%96%87
  • & → %26
  • = → %3D

Why You Need URL Parameter Parsing

  1. API debugging: Analyze query parameters in API requests
  2. SEO analysis: Check tracking parameters (utm_source, etc.)
  3. Parameter extraction: Quickly extract key info from long URLs
  4. URL cleanup: Remove unwanted parameters
  5. Redirect analysis: Analyze parameters in redirect URLs
  6. Link sharing: Strip tracking parameters from URLs

Common URL Parameters

ParameterDescriptionExample
qSearch query?q=javascript
pagePage number?page=2
sortSort order?sort=price_asc
langLanguage?lang=zh
utm_sourceTraffic source?utm_source=google
tokenAuth token?token=abc123
callbackJSONP callback?callback=handleData

How to Use an Online Tool

Using ToolVault's URL Params Parser:

  1. Paste a full URL (must include http:// or https:// — the tool uses new URL(), so a bare ?a=1&b=2 fails)
  2. Click parse; parameters become an editable key/value table
  3. Add, edit, or remove rows — the rebuilt URL updates below
  4. 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 uses encodeURIComponent and 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

  1. Never put secrets in URLs (passwords, tokens) — they land in history and logs
  2. Proxies / CDNs may cache parameterized URLs
  3. Prefer POST body for sensitive data
  4. Set an appropriate Referer policy to limit leakage
  5. 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:

ShapeURLSearchParams behaviorWhy it matters
?tag=a&tag=bget → first; getAll → bothFrameworks that only call get silently drop filters
?flag / ?flag=empty string valueBoolean flags vs “unset” differ by framework
?q=+ vs ?q=%20both become spaceEncoding round-trips must stay consistent
?q=%2Bliteral +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.