Skip to content
DDevToolery

SemVer Comparator

Compare two versions correctly, including prerelease ordering.

Loading tool…

About this tool

Compares two version numbers by precedence and checks whether one satisfies an npm-style range. Each part is compared as a number, which is why 1.10.0 is correctly newer than 1.9.9 even though it sorts earlier alphabetically.

Limitations

  • Build metadata is ignored when ordering, as the specification requires.

Questions

What do ^ and ~ allow?
^1.2.3 permits anything below 2.0.0; ~1.2.3 permits only 1.2.x. Below version 1.0.0 the caret narrows further, because the spec treats 0.x as unstable.
How do prereleases compare?
A prerelease has lower precedence than the release it precedes, so 1.0.0-rc.1 comes before 1.0.0. Build metadata after a plus sign is ignored entirely.

Privacy

This page does its work in your browser. What you paste is processed by JavaScript running on your own device and is never sent to a DevToolery server — there is no server that could receive it. The page itself is a static file delivered by a CDN. See exactly what is stored.