sql.js
sql.js.org
- Free plan
- Web
- API
- Self-hosted
What sql.js is
sql.js is a free JavaScript library for creating and querying relational SQLite databases in web browsers and Node.js. It compiles SQLite to WebAssembly and includes an asm.js build for older-browser compatibility. Applications can run SQL, prepare statements, bind parameters, read results, and register JavaScript functions or aggregate functions for SQL use. Existing SQLite files can be imported, while a database can be exported as a JavaScript typed array. The database uses virtual storage in memory, so changes are not persisted automatically. A Web Worker build can move CPU-intensive queries away from the main application thread, although that build has a more limited API. Contributed math and string extension functions are included. Examples cover npm, webpack, React, and CDNs, and release artifacts include WebAssembly, asm.js, debug, and Web Worker builds. sql.js is MIT licensed, with API documentation for its module, database, statement, and iterator interfaces.
Who it suits
It suits developers building browser or Node.js applications that need SQLite queries in JavaScript. It is also relevant when importing or exporting SQLite files and using Web Workers for heavier queries.
Good to know, and what to watch
- Free MIT-licensed JavaScript library
- Runs SQLite through WebAssembly
- Imports and exports SQLite data
- Supports prepared statements and custom functions
- Provides a Web Worker build
- Changes are not persisted automatically
- Large databases may cause out-of-memory errors
- BigInt binding support is not available
- Web Worker API is more limited
Plans
Every plan and pricesql.js
Free plan
The verdict
sql.js brings SQLite’s relational query model to JavaScript applications running in browsers or Node.js. Its in-memory design and partial BigInt support should be considered when handling larger or persistence-dependent databases.
What the maker publishes
- BigInt limit
- BigInt support is partial: retrieving BigInt values is supported, but binding BigInt values is not. source
- Custom functions
- Applications can register JavaScript functions and custom aggregate functions for use in SQL. source
- Distribution
- The project is hosted on npm and publishes release artifacts, including WebAssembly loader and binary files. source
- Documentation
- The project provides API documentation for its module, database, statement, and statement iterator. source
- Download
- Release artifacts include WebAssembly, asm.js, debug, and Web Worker builds. source
- Extensions
- The library includes contributed math and string extension functions. source
- Implementation
- It compiles SQLite to WebAssembly and also includes an asm.js build for compatibility with older browsers. source
- Import and export
- It can import existing SQLite files and export a database as a JavaScript typed array. source
- In-memory database
- The database uses a virtual file stored in memory, so changes do not persist automatically. source
- In-memory storage
- The database is held in memory, so changes are not persisted automatically. source
- Integrations
- The README shows use with Node.js, npm, webpack, React, and CDNs. source
- License
- The project states that sql.js is MIT licensed. source
- Performance limit
- The README says a native SQLite binding can work directly with database files and avoid loading the entire database into memory, while sql.js may encounter out-of-memory errors. source
- Purpose
- sql.js is a JavaScript library for creating and querying SQLite databases in a browser. source
- SQL API
- The API supports running SQL, preparing statements, binding parameters, and reading query results. source
- SQL features
- The API supports prepared statements and custom JavaScript functions and aggregate functions in SQL. source
- Technology
- It compiles SQLite to WebAssembly and includes an asm.js build for compatibility with older browsers. source
- Web workers
- A Web Worker build can run CPU-intensive SQL queries off the main application thread, with a more limited API. source
Checked against the maker's pages on 7 Oct 2026.