URL Query Sorter
URL Query Sorter parses an absolute URL, sorts URLSearchParams entries alphabetically by key with localeCompare, clears the original query, and appends pairs in that order. Repeated values for the same key retain the runtime's stable order, while serialization can normalize percent encoding and represent spaces with plus signs. Sorting can invalidate signed URLs and does not remove parameters or establish canonical equivalence.
Runs locally — files stay on your deviceAre query values sorted too?
No. Sorting compares parameter names only.
Stable ordering aids comparison but can alter signatures
Many applications treat query order as equivalent, but signature schemes, caches, and poorly designed servers may not.
How it works
All parsed key/value pairs are sorted by key, the query is rebuilt with append, and the fragment remains.
Key concepts
Keys only
Values for identical keys are not alphabetized.
Serialization normalization
Equivalent characters can be written differently after URLSearchParams rebuilding.
When to use it
- Normalize a reviewed unsigned URL for comparison.
- Group repeated parameter names.
- Make logs easier to scan.
When not to use it
- Do not sort signed or order-sensitive URLs.
- Do not expect duplicate removal.
- Do not treat sorted output as a chosen canonical.
Worked examples
Two keys
- Input
?z=1&a=2- Expected output
?a=2&z=1
Names determine order.
Repeated key
- Input
?b=1&a=x&a=y- Expected output
?a=x&a=y&b=1
Duplicate entries remain.
Fragment
- Input
?b=1&a=2#top- Expected output
Sorted query plus #top
Hash is untouched.
Common mistakes
Sorting signed queries
Exact canonical request text may be authenticated. Correction: Follow the signature specification.
Expecting dedupe
Every pair is appended. Correction: Apply an explicit parameter policy.
Assuming universal equivalence
Servers can be order-sensitive. Correction: Test the application.
Best practices
- Use only on known order-insensitive URLs.
- Preserve duplicate-value order when meaningful.
- Compare behavior before adopting normalized links.
Related operations and differences
Canonical Tag Generator
Choose Canonical Tag Generator when you need to generate a canonical link element from a URL.; use URL Query Sorter specifically for sort query.
External Link Extractor
Choose External Link Extractor when you need to extract links pointing away from a hostname.; use URL Query Sorter specifically for sort query.
FAQ Schema Generator
Choose FAQ Schema Generator when you need to generate FAQPage JSON-LD from question-answer blocks.; use URL Query Sorter specifically for sort query.
Heading Structure Checker
Choose Heading Structure Checker when you need to list H1–H6 elements from pasted HTML.; use URL Query Sorter specifically for sort query.
Hreflang Tag Generator
Choose Hreflang Tag Generator when you need to generate language alternate tags from URL lines.; use URL Query Sorter specifically for sort query.
HTML Link Extractor
Choose HTML Link Extractor when you need to extract href values from pasted HTML.; use URL Query Sorter specifically for sort query.
Limitations and privacy
- Absolute URLs only.
- Key sort only; no value sort, dedupe, removal, signature detection, canonical analysis, behavior test, or custom collation.
The pasted text or URL is processed locally in this browser and is not fetched or submitted by the tool.
Frequently asked questions
Are duplicates removed?
No.
Is the fragment preserved?
Yes.
Can spaces change representation?
URL serialization can use plus in query strings.
Does it fetch the URL?
No.