URL Parameter Parser
Paste any URL to split it into protocol, host, path, query parameters and hash. Values are percent-decoded and run through pluggable decoders (JSON, Base64, Unix timestamps, UTM tags). Edit, add or remove parameters and copy the rebuilt URL. 100% client-side, nothing leaves your browser.
Parse & edit
Waiting for input| Key | Value (decoded) | Plugin decoding |
|---|
How URL parsing works here
A URL is a small grammar, and browsers already ship a correct parser for it. This page shows how to use it, how repeated keys behave, and how the decoder registry works.
Parse with the built-in URL API
Don't hand-roll a regex
The URL constructor implements the WHATWG URL Standard, the same algorithm browsers use for links. It splits a string into protocol, hostname, port, pathname, search and hash, and throws a TypeError if the input is not a valid absolute URL.
Query strings
URLSearchParams decodes percent-escapes and treats + as a space. Keys can repeat (id=1&id=2), so the tool keeps a list of pairs, not an object that would silently drop duplicates.
- Missing scheme: input like
example.com/a?b=1getshttps://prepended. - Rebuilding: the pairs are written back through
URLSearchParamsso values are re-encoded correctly.
const u = new URL('https://a.com:8443/x?id=1&id=2#top');
u.hostname; // "a.com"
u.port; // "8443"
u.hash; // "#top"
const pairs = [...u.searchParams];
// [["id","1"],["id","2"]]
u.searchParams.getAll('id'); // ["1","2"] Default ports (443 for https, 80 for http) are dropped by the parser, so port shows empty in that case. That is correct behavior, not a bug.
Register value decoders as plugins
Decoder registry
Each decoder is an object with a name and a detect(key, value) function that returns a readable string or null. The table renders every decoder that matches, so adding one is a single registerDecoder() call and the UI never changes.
Built-in decoders
- JSON: values starting with
{or[that parse, pretty-printed. - Base64: well-formed Base64 or URL-safe Base64 that decodes to printable UTF-8.
- Timestamp: 10-digit seconds or 13-digit milliseconds, shown as ISO 8601 UTC.
- UTM / tracking: flags
utm_*,fbclid,gclidas marketing parameters.
const DECODERS = [];
function registerDecoder(d) {
DECODERS.push(d);
}
registerDecoder({
name: 'timestamp',
detect(key, val) {
if (!/^\d{10}(\d{3})?$/.test(val)) return null;
const ms = val.length === 10 ? val * 1000 : +val;
return new Date(ms).toISOString();
}
}); Decoders must be strict. A false positive (reading 1234567890 as a date when it is an ID) is worse than no decoding, so each one bails out with null early.
Built with vanilla JS and inline CSS in a single Astro page. Uses URL, URLSearchParams, atob and TextDecoder. Settings persist in localStorage.
Lessons Learned — Build Process
Notes from building the parser, the editable table and the decoder registry.
The WHATWG URL Standard defines parsing, percent-encoding sets and the application/x-www-form-urlencoded rules used by URLSearchParams. The MDN page for URLSearchParams documents the duplicate-key and + behavior.
Storing params as an array of [key, value] keeps duplicates and original order. An object keyed by name would merge id=1&id=2 into one entry and reorder numeric keys.
Decoded values are inserted with textContent, never innerHTML, because a query value can contain markup. Reading the URL grammar is also a good habit before pasting links from unknown senders; see how AI-driven scams spread in our cybersecurity AI coverage.
The table loops over DECODERS and never names a specific one. Pair this with the Base64 Encoder to inspect a payload by hand, or the JSON Formatter for long JSON values.
Most URL bugs are encoding bugs. Parse with the platform, keep pairs in order, and decode for display without changing what gets rebuilt.