Javascript mathematics

Libraries for browser-based mathematics, e.g. for browser-based machine learning.

I am not longer active in this area, and my information is definitely somewhat stale. You might want to check google for the latest. In particular I suspect that hardcore use cases for math in the browser now use webassembly or other fast(er) technologies, rather than attempting to use this horrible language to do numerics as many of the below options do.

Simple statistics

simple-statistics 7.6.0


ml-matrix (source) is used in some recent things. The API looks clean and sufficient for many classic ML tasks


math.js supports some useful matrix operations, and seems popular.

Welcome to! is JavaScript math library focused on geospatial and 3D use cases, designed as a composable, modular toolbox. provides a core module with classic vector and matrix classes, and a suite of optional modules implementing various aspects of geospatial and 3D math.

While the is highly optimized for use with the WebGL and WebGPU APIs, itself has no WebGL dependencies.

Backed by Uber, this may survive longer than some other options.


glMatrix (source) is a 3d-rendering-oriented library.


The LORIA ML.js tools lalolib/ mlweb (source).

MLweb is an open-source project that aims at bringing machine learning capabilities to web pages and web applications. See the official website for more information.

MLweb includes the following three components:

  • ML.js: a javascript library for machine learning
  • LALOLib: a javascript library for scientific computing (linear algebra, statistics, optimization)
  • LALOLab: an online Matlab-like development environment (try it at

They implement impressive functionality and even includes native support for worker threads and concurrency. However… it is lacking modern web wrappings such as npm packaging etc, so is not convenient to use from e.g. webpack. The source code repository is not anywhere obvious so I’m not sure how current the code is.


Python from the browser, including mathematical libraries.

HT Emma Krantz.


jStat is a statistical library written in JavaScript that allows you to perform advanced statistical operations without the need of a dedicated statistical language (e.g. MATLAB or R). Includes a tidy linear algebra library, but could be better optimised.


lmfit is a javaScript (emscripten) port of lmfit, a “self-contained C library for Levenberg-Marquardt least-squares minimization and curve fitting”

Currently only linear curve fitting is implemented.


linalg uses native arrays because of their speed.

I needed a performance focused linear algebra module for visualizing data in 10+ dimensions, and implementing machine learning algorithms. I quickly learned that naive solutions to linear algebra operations can produce numerical errors so significant they are utterly useless for anything other than casual playtime. After that, I prioritized correctness over performance.

Untouched since released and small community, which is sad because the code looks solid.


No comments yet. Why not leave one?

GitHub-flavored Markdown & a sane subset of HTML is supported.