TrOCR (Transformer-based Optical Character Recognition) is an end-to-end OCR model released in September 2021 by Microsoft Research. It departs from the traditional two-stage OCR pipeline — which typically combines a CNN-based feature extractor with an RNN-based sequence decoder — by using a pure Transformer architecture composed of a pretrained image Transformer encoder and a pretrained text Transformer decoder, an approach that later became standardized as the VisionEncoderDecoder pattern in Hugging Face Transformers.
TrOCR takes a cropped text line image as input and produces a sequence of output tokens, supporting printed, handwritten, and scene text recognition. The model is designed for use downstream of a separate text detection stage — TrOCR recognizes text in pre-cropped regions rather than detecting text locations in a full page. Microsoft released three size variants: TrOCR-small (62M parameters, DeiT-small encoder + MiniLM decoder), TrOCR-base (334M parameters, BEiT-base encoder + RoBERTa-large decoder), and TrOCR-large (558M parameters, BEiT-large encoder + RoBERTa-large decoder). Pretrained and fine-tuned checkpoints are available for printed text (on SROIE), handwritten text (on IAM), and scene text (on the standard scene text benchmarks) under the MIT license, distributed through the Microsoft unilm repository and Hugging Face. At release, TrOCR achieved state-of-the-art results across all three benchmark categories, and the model continues to be used as a baseline for handwritten text recognition.
TrOCR has not yet been evaluated on the current benchmark. The results below are from the legacy version of Vision Evals, our previous benchmark. See the current Vision Evals
| Category | Passed | Score |
|---|---|---|
| Text Recognition | 16 / 30 | 53.3% |
| Focused Scene OCR | 34 / 99 | 34.3% |
| License Plate Recognition | 10 / 30 | 33.3% |
| VQA & Extraction | 0 / 60 | 0% |
| Handwritten Math | 0 / 10 | 0% |
Scores based on a single evaluation run · Methodology
View all legacy Vision Evals results →Estimated cost per task vs. OCR score, for this model and others ranked near it. Upper-left is the sweet spot (high quality, low cost). Based on Vision Evals (legacy) results.
6 of 7 models plotted · 1 not yet evaluated
| Model | Score | Median tokens | Est. cost / task | Compare |
|---|---|---|---|---|
| Claude Sonnet 4.5 | 67.3% | 866 | $0.0039 | Compare |
| Gemma 3 4B | 64.2% | 314 | <$0.0001 | Compare |
| GPT-5.4 Nano | 62.5% | 294 | $0.0001 | Compare |
| Claude Haiku 4.5 | 61.6% | 861 | $0.0012 | Compare |
| Qwen3.6 Plus | 58.5% | 166 | $0.0001 | Compare |
| TrOCR(this model) | 26.2% | — | — | — |
| Kimi K2.5 | 19.6% | 706 | $0.0008 | Compare |
Other models worth comparing for similar use cases.
License terms and commercial-use guidance for TrOCR.
This model is released under the MIT License, a short and permissive open-source license that allows commercial use, modification, and redistribution.
Yes. Under the terms of the MIT license, you can freely use this model for commercial purposes. You must retain the copyright notice and license text when redistributing.
License information is provided as a guide and is not legal advice.
Yes. TrOCR accepts image input, and on Roboflow's previous vision benchmark it scored 26.2% on OCR.
TrOCR has not yet been evaluated on Roboflow's current Vision Evals. The results on this page are from the previous benchmark.