Semver Comparator
Compare and sort semantic version strings
/v1/semver-compare
curl -X POST "https://devtools.toolkitapi.io/v1/semver-compare" \
-H "Content-Type: application/json" \
-d '{"versions": ["2.1.0", "1.9.5", "2.0.0b1", "2.1.0rc1"]}'
import httpx
resp = httpx.post(
"https://devtools.toolkitapi.io/v1/semver-compare",
json={"versions": ["2.1.0", "1.9.5", "2.0.0b1", "2.1.0rc1"]},
)
print(resp.json())
const resp = await fetch("https://devtools.toolkitapi.io/v1/semver-compare", {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({"versions": ["2.1.0", "1.9.5", "2.0.0b1", "2.1.0rc1"]}),
});
const data = await resp.json();
console.log(data);
# See curl example
{
"sorted": ["1.9.5", "2.0.0b1", "2.1.0rc1", "2.1.0"],
"min": "1.9.5",
"max": "2.1.0"
}
Try It Live
Description
How to Use
1. Send a POST with a JSON body containing a `versions` array of version strings.
2. The response includes the versions sorted from lowest to highest, plus `min` and `max`.
3. For two-version comparisons, check the `comparison` field for a human-readable result.
About This Tool
Semver Comparator takes a list of version strings, sorts them according to PEP 440 / semantic versioning rules, and identifies the minimum and maximum versions. When exactly two versions are provided, it also returns a direct comparison result (e.g. `"1.0.0 < 2.0.0"`).
Pre-release versions (alpha, beta, rc) are sorted correctly — they always come before their corresponding release.
Why Use This Tool
- Release management — Sort release tags to find the latest version
- Dependency auditing — Compare installed vs. required versions
- CI/CD gates — Validate that a new version is greater than the current release
- Changelog generation — Order versions for release notes
Frequently Asked Questions
Which versioning scheme is used?
What happens with invalid version strings?
Can I compare more than two versions?
Start using Semver Comparator now
Get your free API key and make your first request in under a minute.