SemVer compare (2.0.0)
1.0.0 against 1.0.1 gives −1: the first version ranks lower. The comparison follows Semantic Versioning 2.0.0 to the letter, so you never have to sort version numbers by eye. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- First text
- 1.0.0
- Second text
- 1.0.1
- Cmp
- -1
- Relation
- a<b
Compare two Semantic Versioning 2.0.0 strings with precedence rules. Search intent: semver compare / semantic version precedence. No network calls, no random seeds, and no server state are required for a correct answer.
How version precedence works
A semantic version has three numbers separated by dots: major, minor and patch. To decide which of two versions comes first, they are compared from left to right. The first number decides unless both are equal; then the second number decides, and then the third. Each part is compared as a number, not as text. Comparing 1.0.0 with 1.0.1 gives −1: the first two numbers match and the third is lower in the first version, so that one is the older release.
Pre-releases, build metadata and common mistakes
Two extra parts often trip people up. A pre-release, written after a hyphen as in 1.0.0-alpha, always ranks below the release with the same numbers, so a beta never counts as newer than the final version it leads up to. Build metadata, written after a plus sign as in 1.0.0+build, is ignored for precedence: two versions that differ only in that part rank the same. The most common mistake is sorting versions as plain text, which misplaces any number with two digits. The comparison here follows Semantic Versioning 2.0.0, runs with no network calls and always gives the same answer for the same pair.
How it works
Compare two Semantic Versioning 2.0.0 strings with precedence rules. Build metadata is ignored for precedence; prerelease is lower than release. The implementation is pure JavaScript with no external services.
No network calls, no random seeds, and no server state are required for a correct answer. Failed jobs are not billed. Landings target the stated search intent with precise keywords.
Prefer explicit units and ranges over silent coercion of bad types. When a field is optional, defaults are documented in params and echoed in the output. This
When to use it
Use this when your search intent matches the calculator name and you need a reproducible answer for teaching, finance ops, GIS, text tooling, or unit history work. Compare two Semantic Versioning 2.0.0 strings with precedence rules. No network calls, no random seeds, and no server state are required for a correct answer.
Failed jobs are not billed. Landings target the stated search intent with precise keywords. Prefer explicit units and ranges over silent coercion of bad types.
When a field is optional, defaults are documented in
FAQ
Does it call the network?
No. All math and text transforms are local and deterministic.
Is 1.0.0-alpha older than 1.0.0?
Yes. A pre-release, marked with a hyphen and a label such as alpha or beta, always ranks below the release with the same numbers, so 1.0.0-alpha comes before 1.0.0.
Does build metadata change the order?
No. Anything after a plus sign, as in 1.0.0+build, is build metadata and is ignored for precedence, so 1.0.0+build and 1.0.0 count as equal when you compare them.
Why is 10.0.0 newer than 2.0.0?
Because each part is compared as a number, not as text. Ten is greater than two, so 10.0.0 ranks above 2.0.0, even though a plain alphabetical sort would put the 1 before the 2 and get the order wrong.
Which part of a version is compared first?
The first number, the major version. The second number only decides when the first ones match, and the third only when the first two match, which is why 2.0.0 ranks above any version that starts with 1.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/text/semver-compare \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"a":"1.0.0-alpha","b":"1.0.0"}'const res = await fetch("https://api.kit.forhosting.com/text/semver-compare", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"a": "1.0.0-alpha",
"b": "1.0.0"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/text/semver-compare",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"a": "1.0.0-alpha",
"b": "1.0.0"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/text/semver-compare", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"a":"1.0.0-alpha","b":"1.0.0"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"a":"1.0.0-alpha","b":"1.0.0"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/text/semver-compare", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"a": "1.0.0-alpha",
"b": "1.0.0"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "text.semver_compare",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
The calculator is free in the browser, deterministic, and identical in the API path. Inputs are validated before any arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE results when decimals are requested. Use the same JSON contract from spreadsheets, CMS
How it works
The calculator is free in the browser, deterministic, and identical in the API path. Inputs are validated before any arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE results when decimals are requested. Use the same JSON contract from spreadsheets, CMS hooks, automation, or teaching demos.
Inputs, limits and rounding
Optional decimals use half-up once. No network calls, no random seeds, and no server state are required for a correct answer. Failed jobs are not billed. Landings target the stated search intent with precise keywords. Prefer explicit units and ranges over silent coercion of bad types. When Provide the required parameters as JSON numbers or strings as documented. Invalid types, missing required fields, or out-of-range values raise invalid_input with a clear message. Outputs echo key inputs so automation can log the full context of each call. The calculator is free in the browser, deterministic, and identical in the API path. Inputs are validated before any arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE results when decimals are requested. Use the same JSON contract from spreadsheets, CMS hooks, automation, or teaching demos.
When to use it
The calculator is free in the browser, deterministic, and identical in the API path. Inputs are validated before any arithmetic so invalid payloads fail with invalid_input. Half-up rounding is applied once from raw IEEE results when decimals are requested. Use the same JSON contract from spreadsheets, CMS hooks, automation, or teaching demos.
Integration use cases
Quick check
Paste values in the free widget and compare with a spreadsheet.
Automation
Call the API with the same JSON contract from n8n, scripts, or CMS.
Teaching
Show the formula and pinned golden examples without proprietary software.
Technical questions
Is it free in the browser?
Yes. Tier A runs fully client-side with the same core as the API.
What happens on bad input?
The handler throws invalid_input; failed jobs are not billed.
Can I use it from the API?
Yes. Send the same JSON fields documented in params.
Who authors this?
Aspire (elon@forhosting.com), EN-only delivery; Nitro hydrates locales.