Old letters, diaries, parish registers and wartime records are often only available as scans or phone photos of handwriting. Ordinary OCR is built for printed pages, so it tends to struggle with joined-up script. Handwritten text recognition (HTR) uses neural networks trained on handwriting, and Kraken is one of the best-known free engines you can run entirely on your own PC, so your family papers never leave your machine. This guide follows the project's official README and documentation, checked on 30 November 2026.
What Kraken is, and what it isn't
Kraken describes itself as a "turn-key OCR system optimized for historical and non-Latin script material". It is developed at the École Pratique des Hautes Études (EPHE, Université PSL) in Paris, and it is the recognition engine behind the eScriptorium web app. It handles the whole pipeline:
Layout analysis (segmentation): finds the text lines on a page. The recommended mode is a neural baseline segmenter that copes with complex layouts and curved lines.
Recognition: reads each line using a trained model.
Output: plain text, or structured ALTO XML, PageXML or hOCR files that keep the position of every line on the page.
It is a command-line tool with no point-and-click interface. If you want a graphical workspace for checking and correcting transcriptions, look at eScriptorium, a free self-hosted web app built on Kraken, or the cloud service Transkribus. For printed books and typed documents, a general OCR tool is often simpler: see our best free OCR software guide.
What you need
Requirement | Detail (from the official docs) |
|---|
Operating system | Linux or macOS (x64 and ARM). No native Windows support, so Windows users run it in WSL |
Python | Any version from 3.10 to 3.13 |
Install method | pipx install kraken, or pip install kraken inside a virtual environment
|
PDF input | Optional kraken[pdf] extra for PDFs and multi-page TIFF/JPEG2000 |
GPU | Optional. CPU is the default; NVIDIA GPUs via --device cuda:0, Apple Silicon via --device mps |
Models | Download recognition models from the public model repository with kraken get |
You don't need a powerful graphics card to start. Kraken runs on the CPU by default, which is fine for a handful of pages. A GPU starts to matter when you have hundreds or thousands of pages, and the docs note that larger recognition batch sizes need more VRAM.
Step 1: Set up Linux on Windows (Windows users only)
Kraken's README says it runs on Linux and macOS, so on a Windows 11 PC the practical route is the Windows Subsystem for Linux (WSL) with an Ubuntu distribution. If you want GPU acceleration as well, follow our guide to setting up WSL2 with GPU support for local AI first. If you're weighing up WSL against installing Linux properly, see WSL vs dual-booting Linux.
Step 2: Install Kraken
The README recommends keeping Kraken out of your system's Python by using pipx, which creates an isolated environment for it. In an Ubuntu terminal:
sudo apt install pipx
pipx install kraken
If installation fails because pipx picks an unsupported Python version, the README suggests installing a supported interpreter and naming it explicitly:
sudo apt install python3.13-full
pipx install --python python3.13 kraken
If you'd rather use pip, create and activate a virtual environment and run pip install kraken. Add PDF support with pip install kraken[pdf] if your scans are PDFs.
Step 3: Find and download a handwriting model
Kraken can't read anything until you give it a recognition model trained on writing similar to yours. The project maintains a public repository of freely licensed models, and you can browse it from the command line:
kraken list --recognition
The documentation lists filters you can combine: --language, --script and --keyword. Before downloading, use kraken show followed by a model's DOI to read its full record, including its description and the characters it knows.
For modern handwriting in English and other European languages, a sensible starting point is McCATMuS. According to its Zenodo record, it was trained on more than 180 manuscripts in seven languages (French, Latin, Spanish, English, German, Italian and Occitan), covering handwritten, printed and typewritten documents from the early 16th century to the present day. It is released under a CC BY 4.0 licence. Download it with its DOI:
kraken get 10.5281/zenodo.13788177
The last line of the output gives the model's filename. Models are stored in ~/.local/share/kraken (or ~/.local/share/htrmopo, depending on version), and the docs say that once a model is installed there you can refer to it by filename alone.
There are also specialist models for medieval Latin and French, Old Norse and other material. If your documents are unusual, such as shorthand or a single writer's idiosyncratic hand, no public model may suit them well. In that case, training or fine-tuning your own model (Kraken's ketos tools or eScriptorium) is the realistic next step.
Step 4: Prepare your scans
Scan or photograph each page flat, evenly lit and square-on. Remove shadows and crop out the scanner bed or tabletop.
Keep one page per image. Kraken accepts standard image files, and PDFs if you installed the pdf extra.
Don't binarise (convert to black and white) by default. The docs say modern recognition models usually accept greyscale or colour images directly, and binarisation is mostly needed for the legacy bounding-box segmenter.
Step 5: Transcribe a page
The documented pipeline is segmentation followed by recognition. For one page, writing plain text:
kraken -i letter1.jpg letter1.txt segment -bl ocr -m McCATMuS_nfd_nofix_V1.mlmodel
Replace the model filename with whatever kraken get printed on your system. Order matters: the docs explain that options placed before a subcommand (such as -i for input and output, or --device) are global, while options after segment or ocr apply only to that step.
To keep the layout, so you can later load the result into an editor or archive tool, ask for ALTO XML with -a (the format the docs call "the preferred standard") or PageXML with -x:
kraken -i letter1.jpg letter1.xml -a segment -bl ocr -m McCATMuS_nfd_nofix_V1.mlmodel
Step 6: Process a whole folder
For a box of letters, use batch input. -I takes a wildcard pattern and -o sets the suffix added to each output file:
kraken -I "scans/*.jpg" -o .txt segment -bl ocr -m McCATMuS_nfd_nofix_V1.mlmodel
Each page.jpg produces a page.jpg.txt alongside it.
Step 7: Use your graphics card for big jobs
If you have an NVIDIA card set up in WSL or Linux, add the global device option. The documentation's own example combines it with BFloat16 precision, which it recommends for NVIDIA Ampere (RTX 30-series) and newer GPUs, plus a larger recognition batch:
kraken -i page.tif page.txt --device cuda:0 --precision bf16-mixed segment -bl ocr -m model.mlmodel -B 64 --num-line-workers 8
-B sets how many lines are processed in each pass. The docs warn that higher values increase throughput but need more VRAM, so lower it if you run out of graphics memory. You can watch how much you're using with the tools in our VRAM usage guide. --num-line-workers sets how many CPU processes prepare line images for the GPU. On a Mac with Apple Silicon, use --device mps instead.
Checking the results
No HTR engine is perfect, and accuracy depends heavily on how closely your handwriting matches the model's training material. Treat Kraken's output as a first draft. Read it against the original, especially names, dates and place names, which are often what family historians care about most. If you have many pages in the same hand, correcting a sample and training a model on it in eScriptorium is usually worth more than switching between generic models.