tesseract.js

Pure JavaScript OCR library that recognizes text in over 100 languages, running in the browser or Node.js via WebAssembly.

Library
npm
v7.0.0
38,790 stars
Apache License 2.0

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
54 /100 Fair
Development Activity 8
Maintenance 32
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
75 /100 Good
Architecture 78
Code Quality 68
Innovation 72
Learning Curve 80

Tesseract.js is a wrapper around the Tesseract OCR engine, compiled to WebAssembly so it can run entirely client-side in a browser tab or inside Node.js without a server-side dependency. It exposes a small worker-based API — createWorker, recognize, and an optional createScheduler for parallelizing jobs across multiple workers — that hides the complexity of spawning web workers or Node worker threads, loading language training data, and marshaling image data into the WASM module.

The project has been a long-running fixture of the JS OCR ecosystem since 2015, going through multiple major rewrites (v4 through v7) to cut bundle size, reduce memory usage, and simplify the worker API. It supports over 100 languages, common image formats (PNG, JPG, BMP, PBM) via base64 strings, URLs, or file paths, and can return not just plain text but word/line/paragraph bounding boxes, confidence scores, and hOCR/TSV output for downstream layout analysis.

What You Get

  • A createWorker() API that spawns a browser Web Worker or a Node worker/child process pre-loaded with the WASM Tesseract core and the requested language data
  • Support for 100+ languages, selectable individually or combined (e.g. 'eng+chi_sim')
  • A createScheduler() job queue that distributes recognition jobs across a pool of workers for parallel throughput
  • Structured output beyond plain text: per-word/line/paragraph bounding boxes, confidence scores, and hOCR/TSV/box-file formats
  • Image preprocessing options (auto-rotate, grayscale/binary conversion) that can materially improve recognition accuracy
  • Both Legacy and LSTM OCR engine modes (OEM), with LSTM as the modern default

Common Use Cases

  • Client-side document scanning apps that need OCR without sending images to a server
  • Browser extensions and bookmarklets that extract text from screenshots or web images
  • Node.js batch pipelines that OCR scanned documents, receipts, or forms
  • Accessibility tooling that reads text out of images for visually impaired users
  • Prototyping OCR features before committing to a paid cloud OCR API

Under The Hood

Architecture

The library is split into a thin main-thread API (src/createWorker.js, src/createScheduler.js) and a worker-side script (src/worker-script/index.js) that actually loads the compiled Tesseract WASM module and drives recognition; the two communicate over a small message protocol keyed by workerId/jobId/action built in src/createJob.js, so every operation (load, loadLanguage, recognize, FS filesystem calls) becomes an async job resolved by matching response messages back to pending promises. Browser and Node environments are unified through a single import path (src/worker/node vs src/worker/browser, swapped via package.json’s browser field) each implementing the same spawnWorker/send/onMessage/terminateWorker contract, so createWorker.js and the worker script itself are written once and run unmodified in either environment. createScheduler.js adds a simple FIFO job queue over a pool of workers, dequeuing to the first idle worker — a deliberately minimal scheduler rather than a full task-graph system.

Tech Stack

Core recognition comes from tesseract.js-core, a separately published WebAssembly build of the C/C++ Tesseract engine, invoked here through Emscripten’s generated JS glue. Supporting dependencies handle format-specific concerns: bmp-js for BMP decoding, is-url for input-type detection, idb-keyval for caching downloaded language traineddata in IndexedDB (browser) or on disk (Node), zlibjs for gzip decompression of traineddata files, and wasm-feature-detect to pick SIMD-capable core builds when available. The build pipeline uses Webpack (browser UMD bundle) and Rollup (ESM build) with Babel for transpilation, and ships both dist/tesseract.min.js (CDN/script-tag) and an ESM entry point.

Code Quality

Tests run via Mocha (tests/*.test.mjs) against a running dev server for Node, plus Karma for browser-driven tests, covering format support (BMP/JPG/PNG/PBM), base64 input, Legacy vs LSTM OEM output, orientation-corrected images, and the scheduler’s job distribution — a reasonably thorough behavioral suite given the project’s surface area, though it is not type-checked (plain JS with a hand-written .d.ts) and coverage of internal worker-script error paths is thinner than the happy-path recognition tests. ESLint (Airbnb base config) and a GitHub Actions CI workflow (lint + Node/browser test matrix, CodeQL scanning) run on every push, and commits_per_month in the current snapshot is low, consistent with a mature, slow-moving-but-still-maintained project rather than one under active rewrite.

What Makes It Unique

Unlike most JS “OCR” packages that proxy to a cloud API, Tesseract.js runs the actual Tesseract recognition model fully client-side via WebAssembly — no network round-trip, no per-request billing, and it works offline once language data is cached. Its worker abstraction is also unusual in unifying browser Web Workers and Node worker threads/child processes behind one API surface, so the same createWorker/recognize call sites work unmodified in either runtime, which is the main reason it has remained the default choice for in-browser OCR since well before most alternatives supported WebAssembly at all.

Used by 7 apps in this directory

JavaScript
99%
MIT

AnythingLLM

AI Assistants · Automation · Developer Tools

67,496

The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.

View details
91
Repo Health
78
Technical
65
Dependency
Built with
JavaScript 99%
Updated 5 days ago
TypeScript
99%
AGPL 3.0

Cherry Studio

AI Assistants

52,928

All-in-one AI desktop client with 300+ assistants and multi-model support

View details
89
Repo Health
84
Technical
70
Dependency
Built with
TypeScript 99%
Updated 5 days ago
TypeScript
77%
Other

Joplin

Note Taking

56,853

The privacy-first, open-source note-taking app with end-to-end encrypted sync, AI assistance, and a powerful plugin ecosystem across every platform.

View details
93
Repo Health
87
Technical
60
Dependency
Built with
TypeScript 77%
JavaScript 14%
Updated 6 days ago
TypeScript
98%
AGPL 3.0

Karakeep

Bookmarks Archiving

29,926

Self-hosted bookmark manager that captures links, notes, images, and PDFs with AI tagging, full-text search, and automatic archiving.

View details
88
Repo Health
76
Technical
66
Dependency
Built with
TypeScript 98%
Updated 1 weeks ago
Ruby
59%
AGPL 3.0

Mastodon

Social Media

50,441

Run your own federated social network on the open ActivityPub standard with no ads, no algorithms, and no corporate control over your community.

View details
95
Repo Health
81
Technical
70
Dependency
Built with
Ruby 59%
TypeScript 24%
Updated 5 days ago
TypeScript
94%
AGPL 3.0

Papra

Bookmarks Archiving

5,587

Self-hosted document archiving with email ingestion, OCR full-text search, and pluggable storage — store once, find anything.

View details
86
Repo Health
82
Technical
69
Dependency
Built with
TypeScript 94%
Updated 6 days ago
JavaScript
100%
AGPL 3.0

Social Analyzer

Security

24,366

Find and analyze a person's digital footprint across 1000+ social media platforms using multi-layer detection, OCR, and metadata extraction.

View details
42
Repo Health
52
Technical
69
Dependency
Built with
JavaScript 100%
Updated 9 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers