Semantic Version (SemVer) Range Checker and Version Comparator

Type a range and a list of versions to see what matches and what npm would install, compare two versions, sort a list or calculate the next release.

S'exécute dans votre navigateur. Vos fichiers ne quittent jamais votre appareil. Voir comment vérifier

…

Comment faire

  1. 1
    Enter a range

    Type a range or tap one of the common examples.

  2. 2
    Paste versions

    List versions one per line or separated by commas.

  3. 3
    Read the matches

    See match, no or invalid for each version and the highest match.

  4. 4
    Compare two

    Open Compare and enter two versions to see the order and the rule.

  5. 5
    Plan a release

    Open Next version, enter the current version and a pre-release tag.

  6. 6
    Sort and export

    Sort a list by precedence and download it or the match CSV.

À propos de cet outil

Version ranges decide which dependency your package manager installs, and small syntax differences have large effects. ^1.2.3 allows anything up to 2.0.0, but ^0.2.3 stops at 0.3.0. A tilde allows patch updates only, a hyphen range includes its upper bound in a way that depends on how many parts you write, and pre-releases such as 2.0.0-rc.1 are excluded from most ranges even when they look like they are inside. Comparing versions is also less obvious than it seems: 1.0.0-beta.11 is newer than 1.0.0-beta.2, and 1.0.0-alpha is older than 1.0.0. This tool implements Semantic Versioning 2.0.0 precedence and the npm range grammar so you can see exactly what a range means, test it against real version lists, compare any two versions with the rule that decided the order, sort a release list and work out the next major, minor, patch or pre-release number.

Range checker

Ranges accept caret, tilde, x and * wildcards, comparison operators, hyphen ranges and OR groups with ||. The tool rewrites the range into plain comparators, for example ^1.4.0 as >=1.4.0 <2.0.0, then marks each version in your list as match, no or invalid, with the reason. The highest match is what npm would install from that list. A switch treats bare versions as caret ranges, which is how Cargo reads dependency versions, and another includes pre-releases like npm's include-prerelease option.

The pre-release rule

A version with a pre-release tag only satisfies a range if one of the comparators in the same group names the same major, minor and patch with a pre-release. So >=1.2.3-beta.2 allows 1.2.3-beta.4 but not 1.3.0-beta.1. The table explains when this rule excluded a version.

Compare two versions

Major, minor and patch compare as numbers. Then a release outranks any pre-release of the same version, pre-release identifiers compare left to right, numbers compare as numbers, text compares in ASCII order, numbers rank lower than text, and a shorter list ranks lower when the rest is equal. Build metadata after the plus sign is ignored. The tool names the rule that decided.

Next version and sorting

The bump table shows major, minor, patch and the pre-release variants with your identifier such as rc or beta. The sort tab orders any list by precedence and reports invalid entries such as 01.2.3 or 1.2.

Limits

Ranges follow npm syntax. Python's PEP 440, Maven ranges and Go's minimal version selection use different rules and are not supported. The tool does not query registries, so the versions you test are the ones you paste.

Exemple concret

A project depends on ^1.4.0 || ~2.1.3 and the registry lists ten versions from 1.3.9 to 3.0.0-rc.1. The checker rewrites the range as >=1.4.0 <2.0.0 OR >=2.1.3 <2.2.0 and marks 4 of 10 as matches: 1.4.0, 1.9.12, 2.1.3 and 2.1.9. The highest match, 2.1.9, is what npm installs. 1.4.0-beta.2 is excluded by the pre-release rule even though it sorts between 1.3.9 and 1.4.0. Comparing 1.0.0-beta.11 with 1.0.0-rc.1 gives less than, decided by ASCII order of beta and rc.

L'essentiel

Questions fréquentes

What does the caret mean?

Allow changes that do not modify the left-most non-zero part. ^1.2.3 means >=1.2.3 <2.0.0, ^0.2.3 means >=0.2.3 <0.3.0 and ^0.0.3 means only 0.0.3.

What does the tilde mean?

Allow patch-level changes when a minor version is given: ~1.2.3 means >=1.2.3 <1.3.0. ~1 means any 1.x version.

Why is 2.0.0-rc.1 not matched by >=1.0.0?

npm excludes pre-releases unless a comparator in the same range names the same major.minor.patch with a pre-release, so that unstable builds are not installed by accident. Turn on Include pre-releases to test without this rule.

Is 1.0.0+build.5 newer than 1.0.0?

No. Build metadata does not affect precedence; the two versions are equal in order.

Is v1.2.3 valid?

The leading v is accepted for convenience, as npm does, but the official version string is 1.2.3. Leading zeros such as 1.02.3 are invalid.

Is anything saved online?

No. All checks run in your browser and the last inputs are stored locally with undo and redo.

Entièrement gratuitAucun coût, aucune inscription
Fichiers privésTout s'exécute dans votre navigateur
Simple dans votre langueDisponible en de nombreuses langues