JavaScript OCR libraries, tested in Node
98.1%
of screenshot words, read by npm paddleocr
Scans: system-ocr found the most
Ten scanned book pages, 1,955 words. Node 22 on a Mac, 2 threads each, but system-ocr has no thread setting.
| Library | Words |
|---|---|
| system-ocr (Apple Vision) | 1,931 |
| paddleocr (PP-OCRv5) | 1,908 |
| Scribe.js | 1,885 |
| tesseract.js | 1,876 |
| ppu-paddle-ocr (PP-OCRv6 tiny) | 1,851 |
| Guten OCR (PP-OCRv4) | 1,798 |
system-ocr calls Apple Vision on a Mac and Windows OCR on Windows, with no Linux build. Of the rest, paddleocr found the most.
Screenshots: tesseract.js came last overall
| Library | Right |
|---|---|
| paddleocr | 98.1% |
| Scribe.js | 97.1% |
| system-ocr | 96.9% |
| ppu-paddle-ocr | 95.2% |
| Guten OCR | 89.0% |
| tesseract.js | 87.3% |
On the 1x chat shots of our screenshot test, tesseract.js got 52.5% of words right. The other five got 77.5% or more.
At 1x alone, Guten OCR was last: 80.0%, against 85.0% for tesseract.js.
The ONNX libraries weigh over 300 MB
| Library | Install | Memory |
|---|---|---|
| system-ocr | 0.9 MB | 0.2 GB |
| tesseract.js | 52 MB | 0.4 GB |
| Scribe.js | 74 MB | 1.1 GB |
| paddleocr | 341 MB | 0.5 GB |
| ppu-paddle-ocr | 354 MB | 1.3 GB |
| Guten OCR | 354 MB | 3.1 GB |
onnxruntime-node is 308 MB of each ONNX install. The tesseract.js and Scribe.js memory is for 2 workers.
tesseract.js: short, and runs anywhere
Save each example as page.mjs, next to page.jpg.
npm install tesseract.js
import { createWorker } from "tesseract.js";
const worker = await createWorker("eng");
const { data } = await worker.recognize("page.jpg");
console.log(data.text);
await worker.terminate();
-
On first use it saves
eng.traineddata, 5 MB, in the current folder. No PDFs. Apache-2.0, Node 16 or newer.
paddleocr: bring your own models
npm install paddleocr onnxruntime-node sharp yaml
for m in PP-OCRv5_mobile_det_onnx en_PP-OCRv5_mobile_rec_onnx; do
mkdir -p $m
for f in inference.onnx inference.yml; do
curl -fsSL -o $m/$f https://huggingface.co/PaddlePaddle/$m/resolve/main/$f
done
done
- The npm package ships no models and no image decoder. This script gets PaddlePaddle's ONNX files (Apache-2.0), and sharp decodes the image.
-
The English model's character list is in its
inference.yml. - paddleocr itself is MIT. sharp needs Node 20.9 or newer.
Then read the page
import fs from "node:fs";
import * as ort from "onnxruntime-node";
import { PaddleOcrService } from "paddleocr";
import sharp from "sharp";
import YAML from "yaml";
const DET = "PP-OCRv5_mobile_det_onnx";
const REC = "en_PP-OCRv5_mobile_rec_onnx";
const model = (dir) => new Uint8Array(fs.readFileSync(`${dir}/inference.onnx`)).buffer;
const yml = YAML.parse(fs.readFileSync(`${REC}/inference.yml`, "utf8"));
// paddleocr has no thread option, so cap ONNX Runtime here
const create = (m, o) => ort.InferenceSession.create(m, { ...o, intraOpNumThreads: 2 });
const ocr = await PaddleOcrService.createInstance({
ort: { ...ort, InferenceSession: { create } },
modelPreset: "PP-OCRv5_mobile",
detection: { modelBuffer: model(DET) },
recognition: {
modelBuffer: model(REC),
charactersDictionary: yml.PostProcess.character_dict,
},
});
const img = await sharp("page.jpg").removeAlpha().raw().toBuffer({ resolveWithObject: true });
const result = await ocr.recognize({ ...img.info, data: img.data });
console.log(ocr.processRecognition(result).text);
await ocr.destroy();
ppu-paddle-ocr: PP-OCRv6, with one catch
npm install ppu-paddle-ocr onnxruntime-node
import fs from "node:fs";
import { PaddleOcrService } from "ppu-paddle-ocr";
const ocr = new PaddleOcrService({ session: { intraOpNumThreads: 2 } });
await ocr.initialize();
// a string must be a URL or start with "/", so pass the bytes
const b = fs.readFileSync("page.jpg");
const result = await ocr.recognize(b.buffer.slice(b.byteOffset, b.byteOffset + b.byteLength));
console.log(result.text);
await ocr.destroy();
-
MIT. On first use it downloads PP-OCRv6 tiny, 6.4 MB, to
~/.cache/ppu-paddle-ocr. -
A string must be a URL or start with
/, so"page.jpg"throwsInvalid image string format. Bytes work on every OS.
system-ocr: the OS does the reading
npm install @napi-rs/system-ocr
import { recognize } from "@napi-rs/system-ocr";
const result = await recognize("page.jpg");
console.log(result.text);
- Mac and Windows only. MIT. The install is 0.9 MB, with no model to download.
Scribe.js and Guten OCR
- Scribe.js reads PDFs, and came second on screenshots, 6 words ahead of system-ocr.
- Scribe.js is AGPL-3.0. Its docs say your program must be AGPL 3.0 or compatible, or you buy a license.
- Guten OCR from npm still installs PP-OCRv4 models. Its GitHub moved to v5 in September, with no npm release since.
- It used the most memory here: a 3.1 GB peak on the scans.
Or call our Actor from JavaScript
Our Apify Actor, PDF to Markdown OCR, reads scans and images by URL:
npm install apify-client
import { ApifyClient } from "apify-client";
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
const run = await client.actor("brasspage/pdf-ocr-to-markdown").call({
documentUrls: ["https://example.com/scan.pdf"],
});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
for (const doc of items) console.log(doc.markdown);
- On November 17 its code found 1,879 of these 1,955 words on our Mac.
- On November 16 its code got 93.1% of screenshot words right, below four libraries.
- A scanned page or image costs $0.006, plus $0.00005 to start each run at the default 1 GB of memory.
- We make the Actor, not the libraries.
How I tested, and what I skipped
- A Mac with Apple M5 Max, macOS 26.6, Node 22.22.2.
- The scans: 10 proofread pages from two public domain books on Wikisource, 1920 px JPEGs. Score: true words found in order.
- The screenshots: 16 scenes drawn in Chromium at 1x and 2x. Score: words right, in any order.
-
One library at a time, at low priority. The ONNX libraries had
intraOpNumThreadsat 2. - tesseract.js and Scribe.js ran 2 workers, 2 pages at once.
- No times: every run was at background priority on a busy Mac. tesseract.js took 7.9 s a page here, 1.8 s in our Scribe.js guide.
- Our Scribe.js guide found 1,894 to 1,895 words with 0.18.2, from the same pages in a PDF.
- Scripts and results stay in our private repo, in research/bench/javascript-ocr-2026-11-25/.
| Package | Version |
|---|---|
| tesseract.js | 7.0.0 |
| scribe.js-ocr | 0.18.3 |
| paddleocr | 1.2.1 |
| ppu-paddle-ocr | 6.7.1 |
| @gutenye/ocr-node | 1.4.9 |
| @napi-rs/system-ocr | 1.2.0 |
| onnxruntime-node | 1.31.1 |
| apify-client | 2.26.0 |
What I did not test
- Browsers. tesseract.js, Scribe.js, paddleocr, ppu-paddle-ocr and Guten OCR say they run there too.
- Linux, Windows, GPUs and the CoreML provider.
- Languages other than English, and PDFs.
- @qvac/ocr-ggml, and the official @paddleocr/paddleocr-js.
Questions people ask
What is the best OCR library for JavaScript?
In our Node test, paddleocr with PP-OCRv5 models got the most screenshot words right, 98.1%. On scans, system-ocr found the most on a Mac, with Apple Vision. I did not test Windows.
Is tesseract.js accurate?
On our scans it was fourth of six: 1,876 of 1,955 words. On screenshots it was last of six overall, with 87.3% of words right.
Can JavaScript OCR run in the browser?
tesseract.js, Scribe.js, paddleocr, ppu-paddle-ocr and Guten OCR (as @gutenye/ocr-browser) say they can. I tested Node only.
Does tesseract.js read PDFs?
No, its README says so. Scribe.js reads PDFs, and so does our Actor.