38,828
stars
+1
2,403
forks
479
watchers
303
prs
742
issues
57
releases
26
discussions
README
!Lint & Test
!CodeQL
!npm
!jsDelivr hits (npm)
Tesseract.js is a javascript library that gets words in almost any language out of images. (Demo)
Image Recognition
Video Real-time Recognition
Tesseract.js works in the browser using webpack, esm, or plain script tags with a CDN and on the server with Node.js.
After you install it, using it is as simple as:
javascript
import { createWorker } from 'tesseract.js';
(async () = {
const worker = await createWorker('eng');
const ret = await worker.recognize('https://tesseract.projectnaptha.com/img/eng_bw.png');
console.log(ret.data.text);
await worker.terminate();
})();
When recognizing multiple images, users should create a worker once, run worker.recognize for each image, and then run worker.terminate() once at the end (rather than running the above snippet for every image).
Installation
Tesseract.js works with a tag via local copy or CDN, with webpack via npm and on Node.js with npm/yarn.
CDN
html
After including the script the Tesseract variable will be globally available and a worker can be created using Tesseract.createWorker.
Alternatively, an ESM build (used with import syntax) can be found at https://cdn.jsdelivr.net/npm/tesseract.js@5/dist/tesseract.esm.min.js.
Node.js
Tesseract.js v7 requires Node.js v16 or newer. (Tesseract.js v6 requires Node.js v14 or newer.)
shell
For latest version
npm install tesseract.js
yarn add tesseract.js
For old versions
npm install [email protected]
yarn add [email protected]
Project Scope
Tesseract.js aims to bring the Tesseract OCR engine (a separate project) to the browser and Node.js, and works by wrapping a WebAssembly port of Tesseract. This project does not modify core Tesseract features. Most notably, Tesseract.js does not support PDF files and does not modify the Tesseract recognition model to improve accuracy.
If your project requires features outside of this scope, consider the Scribe.js library. Scribe.js is an alternative library created to accommodate common feature requests that are outside of the scope of this repo. Scribe.js includes improvements to the Tesseract recognition model and supports extracting text from PDF documents, among other features. For more information see Scribe.js vs. Tesseract.js.
Documentation
Workers vs. Schedulers
Examples
Supported Image Formats
API
Local Installation
FAQ
Community Projects and Examples
The following are examples and projects built by the community using Tesseract.js. Officially supported examples are found in the examples directory.
- Projects
- Scribe OCR: web application for scanning documents (images and PDFs)
- Site at scribeocr.com, repo at github.com/scribeocr/scribeocr
- Chrome Extension (with Manifest V3): https://github.com/Tshetrim/Image-To-Text-OCR-extension-for-ChatGPT
- Examples
- Converting PDF to text: https://github.com/racosa/pdf2text-ocr
- Use blocks output to generate granular data [word/symbol levTop issues
#930Tesseract.js Bug on IBM i Server9 comments · 2024-06-12#961Browser extension Manifest version 3 is experiencing issues with Tesseract.js8 comments · 2024-09-23#899JSDelivr CDN not accessible in China8 comments · 2024-03-03#883Text not Detecting in conversation5 comments · 2024-02-02#485Top property in rectangles5 comments · 2020-09-24#963Tesseract.js (v5.1.1) Fails on Angled Text Recognition4 comments · 2024-09-27#890Switch from CommonJS to ESM modules4 comments · 2024-02-14#712Cannot catch spawnWorker() error outside4 comments · 2023-02-08
Discussions
#1086ManaWG: in-browser receipt import with tesseract.js 70 comments · 2026-11-06#1069Tesseract.js returning empty strings from getDisplayMedia screen-capture crop — why?0 comments · 2026-07-24#1053Proposal: WFGY “OCR→LLM robustness clinic” demo on top of Tesseract.js0 comments · 2026-02-06#1048Intel Mac build error: The source directory "/src/third_party/zlib" does not appear to contain CMakeLists.txt.2 comments · 2026-01-10#1028HELP! Can't get tesseract to work as a vs code extension0 comments · 2025-08-02#1025Setting Parameters in Scheduled Job0 comments · 2025-07-18#1016Tesseract.js WebUI2 comments · 2025-04-12#1007problem with detection0 comments · 2025-03-20
Latest release
v7.0.0 v7.0.0 2025-12-15What's Changed
Significant improvements to recognition speed (by @fanchenkong1 in https://github.com/naptha/tesseract.js/pull/1039)
A new relaxedsimd build takes advantage of the latest WASM and hardware capabilities.
Upgrading from v6 to v7 reduces runtimes by ~15-35% (depending on device and use-case). The highest uplifts are currently seen on the latest Intel processors.
Dropped support for Node.js v14.
Various minor changes
New Contributors
@hata6502 made their first contribution in https://github.com/naptha/tesseract.js/pull/1035
@fanchenkong1 made their first c