Home › Developer Tools › Semantic Version Calculator

Semantic Version Calculator

Work out the next version number, check which of two versions is newer, see exactly what an npm range like ^1.2.0 or ~1.4 allows, or sort a messy list of versions, all with the official SemVer 2.0.0 precedence rules.

Last updated:

What do you want to do?

Used by the pre* bump types, like npm version --preid

npm syntax: ^1.2.3, ~1.2, 1.x, >=1.0.0 <2.0.0, 1.0.0 - 1.5.0, joined with ||

Enter your values to see the result.
Advertisement
Advertisement

How to use the Semantic Version Calculator

  1. Pick a task: bump, compare, range test or sort.
  2. Type your version(s). A leading v (v1.2.3) is accepted; build metadata after + is kept but ignored for ordering.
  3. For a bump, choose the bump type and, for pre-releases, a label like beta.
  4. For a range, paste the range from package.json and the versions you want to test.
  5. Read the result and the working, then copy it or download the table as CSV.

SemVer precedence in four rules

  1. Compare MAJOR, MINOR and PATCH as numbers, left to right. The first difference decides: 2.0.0 > 1.99.99 and 1.10.0 > 1.9.0.
  2. A pre-release ranks below its release: 1.0.0-rc.1 < 1.0.0.
  3. Pre-release identifiers are compared one by one: numbers numerically (beta.2 < beta.11), words in ASCII order (alpha < beta < rc), and a number always ranks below a word.
  4. More identifiers win when all earlier ones are equal: 1.0.0-alpha < 1.0.0-alpha.1. Build metadata after + never counts.

Full example order: 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0.

npm range cheat sheet

RangeMeansAllows, for example
^1.2.3>=1.2.3 <2.0.0-01.2.3, 1.3.0, 1.99.0
^0.2.3>=0.2.3 <0.3.0-00.2.3, 0.2.9 (not 0.3.0)
^0.0.3>=0.0.3 <0.0.4-00.0.3 only
~1.2.3>=1.2.3 <1.3.0-01.2.3, 1.2.10
~1>=1.0.0 <2.0.0-01.0.0 to 1.x.x
1.2.x or 1.2>=1.2.0 <1.3.0-01.2.0, 1.2.7
1.2.3 - 2.3>=1.2.3 <2.4.0-01.2.3 up to 2.3.x
>1.2>=1.3.01.3.0 and later
<=1.2<1.3.0-0anything up to 1.2.x
* or "" or xany versionevery stable release
A || BA or B^1.0.0 || ^2.0.0

Which number should I bump?

Change you madeBump1.4.2 becomes
Fixed a bug, no API changepatch1.4.3
Added a feature, old code still worksminor1.5.0
Removed or changed something users rely onmajor2.0.0
Testing the next major before releasepremajor --preid=beta2.0.0-beta.0
Another test buildprerelease2.0.0-beta.1

Versions 0.y.z are for initial development: anything may change at any time, which is why the caret treats the first non-zero number as the "major" one. Release 1.0.0 once your public API is stable.

Frequently asked questions

What is semantic versioning?

Semantic Versioning (SemVer 2.0.0) writes versions as MAJOR.MINOR.PATCH. You increase MAJOR for incompatible API changes, MINOR for backwards-compatible features and PATCH for backwards-compatible bug fixes. Optional pre-release (-beta.1) and build (+sha.5114f85) parts can follow.

What is the difference between ^ and ~ in package.json?

The caret allows changes that do not modify the left-most non-zero number: ^1.2.3 means >=1.2.3 <2.0.0, but ^0.2.3 means >=0.2.3 <0.3.0. The tilde allows only patch updates when a minor is given: ~1.2.3 means >=1.2.3 <1.3.0.

Why is 1.10.0 newer than 1.9.0?

Each part is compared as a whole number, not as text. 10 is greater than 9, so 1.10.0 has higher precedence even though it would sort earlier alphabetically.

Is 1.0.0-rc.1 higher or lower than 1.0.0?

Lower. A pre-release version ranks below the normal release with the same MAJOR.MINOR.PATCH, so 1.0.0-alpha < 1.0.0-beta < 1.0.0-rc.1 < 1.0.0.

Why doesn't ^1.2.0 match 1.5.0-beta.1?

npm skips pre-releases unless a comparator in the same part of the range also has a pre-release on the same MAJOR.MINOR.PATCH. This stops users from getting unstable builds by accident. Tick 'Include pre-releases' to match them anyway, like the --include-prerelease flag.

What does the -0 in <2.0.0-0 mean?

It is the lowest possible pre-release of 2.0.0. Writing the upper bound as <2.0.0-0 excludes every 2.0.0 pre-release as well as 2.0.0 itself, which is how npm expands ^1.2.3 internally.

Does build metadata affect version order?

No. Anything after a plus sign, such as +build.42, is ignored when determining precedence, so 1.0.0+a and 1.0.0+b are equal in rank.

Are all the tools on FreeToolCabin tested for quality and accuracy?

Yes! Every tool on our site undergoes automated Q/A testing in real browser environments to ensure high precision, correct output, and zero errors. If you happen to spot a bug or have a suggestion, please contact us at [email protected] and our team will review it right away.

Related tools

package.json GeneratorFill a form and get a valid, npm-ready package.json with scripts, dependencies and checks.Changelog GeneratorTurn Conventional Commit messages into a grouped Keep a Changelog Markdown file per version.Git Branch Name GeneratorTurn a ticket ID and title into a clean, valid git branch name like feature/PROJ-12-add-login.Commit Message GeneratorBuild Conventional Commit messages with type, scope, body, breaking change and issue refs.Online Python CompilerRun Python 3 in your browser with input(), numpy, pandas, charts and share links.JSON EditorEdit JSON in a tree and as code side by side: add, rename, drag, change types, undo and download.Unzip FilesOpen and extract ZIP files online.RAR & 7z ExtractorOpen RAR, 7z and other archives online and extract files.Regex TesterTest and debug regular expressions live.File Info ViewerCheck file size, type, date and MD5/SHA hashes.SQLite ViewerOpen .db and .sqlite files in your browser, browse tables and run SQL queries.DOCX ViewerOpen and read Word .docx files in your browser, then print or save them as HTML.EPUB ReaderOpen and read EPUB e-books in your browser with pages, a table of contents and font controls.What Is My BrowserSee your browser, version, OS, engine, screen and which web features it supports.Font ViewerPreview TTF, OTF, WOFF and WOFF2 fonts with sample text, waterfall, glyphs and metadata.Markdown EditorWrite Markdown with a toolbar, live split preview, autosave and .md or HTML export.Regex Cheat Sheet75+ ready-to-use regex patterns for emails, URLs, IPs and dates, each with a live test box.JavaScript Keycode FinderPress any key to see its JavaScript key, code, keyCode, which, location and modifiers.QR Code ScannerScan QR codes with your camera or from an image and safely read the link or text.RAID CalculatorUsable capacity, efficiency and fault tolerance for RAID 0, 1, 5, 6, 10, 50 and 60 arrays.JSONPath TesterTest JSONPath expressions live: filters, slices, wildcards and recursive search, with matches highlighted.Mermaid Diagram EditorWrite Mermaid code and see flowcharts, sequence, Gantt and ER diagrams live. Export SVG or PNG.Country Codes ListSearch ISO 3166 alpha-2, alpha-3 and numeric country codes with calling codes and TLDs.CSS Selector TesterTest CSS selectors on your HTML: highlighted matches, match count and specificity.Git Cheat SheetSearchable Git command reference by task, with copy buttons and an undo/rename/fix wizard.HAR File ViewerOpen a .har file to see a waterfall timeline, headers, bodies, timings and size totals.jq PlaygroundRun jq filters on JSON in your browser with live output, flags and an example library.Markdown Cheat SheetInteractive Markdown syntax reference: edit every example and see the live rendered preview.Regex ExplainerPaste a regular expression and get a plain-English breakdown, railroad diagram and flag notes.XPath TesterTest XPath expressions on XML or HTML: highlighted matches, node paths, values and examples.EML File ViewerOpen .eml email files to read the message, headers and raw source and save attachments.Graphviz Online ViewerWrite Graphviz DOT code and render graphs live; switch layout engines, export SVG or PNG.JavaScript Online CompilerWrite and run JavaScript in your browser with a console, timing, error lines and share links.Jupyter Notebook ViewerOpen .ipynb files and read code, Markdown, math, tables, plots and errors without Python.LaTeX Table GeneratorEdit a table like a spreadsheet or paste from Excel and get LaTeX tabular or booktabs code.Log File ViewerOpen huge log files with level colors, regex and time filters, JSON pretty-print and tail -f.Logic Gate SimulatorBuild logic circuits with AND, OR, NOT, XOR gates and flip-flops; see live outputs and truth tables.MSG File ViewerOpen Outlook .msg emails in your browser: sender, recipients, body, headers and attachments.MongoDB Query TesterTest MongoDB find filters, projections and aggregation pipelines on sample JSON documents.XSLT TesterRun an XSLT 1.0 stylesheet on XML in your browser and see the output as HTML, XML or text.ASCII Diagram EditorDraw boxes, arrows and text on a character grid and copy plain-text diagrams for code and READMEs.DBF File ViewerOpen dBase .dbf files and shapefile tables, search and sort records, export CSV or XLSX.MBOX File ViewerOpen .mbox mail archives: list and search messages, read them, save attachments, export EML.MDB File ViewerOpen Access .mdb and .accdb databases in your browser: list tables, view rows, export CSV.Shapefile ViewerView zipped shapefiles on a map with the attribute table, then export to GeoJSON or CSV.Online Code EditorVS Code-style editor in your browser: tabs, 50+ languages, find/replace, autosave.Online Hex EditorOpen any file as hex and ASCII, edit bytes, search, inspect values and save the result.PHP Online CompilerRun PHP 8 code in your browser with output, HTML preview, error lines and share links.PlantUML EditorWrite PlantUML and see sequence, class, activity and more diagrams live. Export SVG or PNG.Sorting Algorithm VisualizerWatch bubble, insertion, merge, quick, heap and radix sort step by step with live counters.Lottie ViewerOpen Lottie JSON or .lottie files to play, pause, scrub frames, change speed and see details.Diff ViewerPaste a git diff or .patch file and view it side by side or inline, with file navigation.EditorConfig GeneratorBuild an .editorconfig with indent, charset, line endings and trim rules per file pattern.Folder Compare ToolCompare two folders by file list, size and SHA-256 hash, then open a text diff of changed files.Glob Pattern TesterTest glob patterns like **/*.js, {a,b} and !exclusions against a list of file paths.JMESPath TesterEvaluate JMESPath expressions against JSON live, the query language used by the AWS CLI.
See all 53 Code Playgrounds & Testers →