Check a Version Against a SemVer Range
Check whether a version fits a range in one step: 1.5.2 satisfies >=1.0.0 <2.0.0, while 1.5.0-beta.1 does not, because a broad range never lets an unstable build in by accident. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Test a package version against a semantic version range without installing a package manager or relying on string comparison. This capability validates a strict Semantic Versioning 2.0.0 version, parses the supplied constraint, and returns a direct true-or-false result. It supports exact versions, inequality comparators, caret compatibility, tilde compatibility, whitespace-separated intersections, and double-pipe alternatives. Malformed versions and range expressions return an input error, making the checker suitable for release tooling, dependency audits, deployment policies, and interactive troubleshooting.
Choose the range form that expresses your compatibility policy
A range should describe the releases your software can actually accept, not merely resemble a version label. Enter a complete semantic version such as 1.4.7, then choose one of the supported constraint forms. An exact range such as 1.4.7 accepts only equal SemVer precedence.
Comparators including >=1.0.0, <2.0.0, and <=3.5.1 establish explicit boundaries. Separate comparator terms with whitespace to require all of them, as in >=1.0.0 <2.0.0. Use a double pipe to allow either of several alternatives, such as ^1.8.0 || ^2.2.0.
The checker treats build metadata according to SemVer: metadata is validated but does not change precedence. Inputs must include major, minor, and patch numbers, so shortened or loose versions are rejected rather than interpreted ambiguously.
Understand caret, tilde, and prerelease behavior
Caret and tilde ranges encode two common compatibility policies. A caret range normally permits changes that do not alter the leftmost nonzero component. Therefore ^1.2.3 accepts releases from 1.2.3 up to, but not including, 2.0.0.
Zero-major versions receive narrower treatment: ^0.2.3 stops before 0.3.0, and ^0.0.3 stops before 0.0.4. A tilde range allows patch-level movement within the stated minor line, so ~1.2.3 begins at 1.2.3 and stops before 1.3.0. Prereleases require special care because a broad ordinary range should not accidentally admit unstable builds.
A prerelease version can satisfy a comparator set only when that set contains a prerelease comparator with the same major, minor, and patch core. For example, 2.0.0-beta.2 may match >=2.0.0-beta.1 <2.0.0, but 1.5.0-beta.1 does not match >=1.0.0 <2.0.0. This follows familiar package-manager safety behavior while retaining strict SemVer precedence among prerelease identifiers.
These boundaries make the intended stability policy explicit.
Apply deterministic checks in release and dependency workflows
This checker is useful wherever a version policy must become a repeatable decision. A continuous integration job can confirm that a runtime version meets a package requirement before tests begin. A deployment service can reject an artifact that falls outside an approved release line.
A dependency inventory can evaluate recorded versions against a migration target, while a support engineer can reproduce a disputed compatibility result in the browser. The implementation performs no network requests, reads no clock, and generates no random values, so identical inputs always produce identical outputs. Numeric version components are compared as digit strings instead of JavaScript numbers, preserving correct results beyond the safe integer limit.
What you can do with it
Enforce runtime requirements
Check a detected runtime or tool version against the supported range before a build or deployment proceeds.
Audit package compatibility
Evaluate installed dependency versions against declared compatibility policies without running a package manager.
FAQ
Which range operators are supported?
Exact versions, <, <=, >, >=, =, caret, tilde, whitespace-separated AND terms, and double-pipe OR alternatives are supported.
Does build metadata affect satisfaction?
No. Build metadata is validated, but SemVer excludes it from version precedence.
Why does a prerelease fail a broad range?
A prerelease is admitted only when its comparator set includes a prerelease with the same major, minor, and patch core.
Are shortened versions or wildcard ranges accepted?
No. Versions must contain major, minor, and patch components, and unsupported wildcard or loose syntax returns an input error.
How far does a caret range like ^1.2.3 reach?
From 1.2.3 up to, but not including, 2.0.0. With a zero major number it is narrower: ^0.2.3 stops before 0.3.0 and ^0.0.3 before 0.0.4. A tilde range such as ~1.2.3 stops before 1.3.0.
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/dev2/package-version-range-check \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"version":"1.5.2","range":">=1.0.0 <2.0.0"}'const res = await fetch("https://api.kit.forhosting.com/dev2/package-version-range-check", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"version": "1.5.2",
"range": ">=1.0.0 <2.0.0"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/dev2/package-version-range-check",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"version": "1.5.2",
"range": ">=1.0.0 <2.0.0"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/dev2/package-version-range-check", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"version":"1.5.2","range":">=1.0.0 <2.0.0"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"version":"1.5.2","range":">=1.0.0 <2.0.0"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/dev2/package-version-range-check", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"version": "1.5.2",
"range": ">=1.0.0 <2.0.0"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "dev2.package_version_range_check",
"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.
Limits
max_chars_per_input | 2048 |
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
Choose the range form that expresses your compatibility policy
The returned satisfies field is a Boolean designed for direct use in conditions, while the normalized response also echoes the submitted version and range so logs and user interfaces can show exactly which policy was evaluated.
Apply deterministic checks in release and dependency workflows
Invalid range syntax produces an invalid_input error rather than a false result; this distinction matters because false means a valid policy rejected the version, while an error means the policy itself needs correction.
Integration use cases
Troubleshoot release selection
Reproduce caret, tilde, comparator, and prerelease decisions with a clear Boolean result.
Technical questions
What happens when the range is malformed?
The capability returns an invalid_input error instead of treating a malformed policy as a valid range that does not match.