Magika is an open-source file type detection tool from Google that replaces decades-old magic-byte heuristics with a deep learning model. With more than 18,700 stars on GitHub, it identifies over 200 content types โ binary and text โ with around 99% average precision and recall, in roughly five milliseconds per file on a single CPU. Magika already runs at Google scale, routing files for Gmail, Drive, and Safe Browsing, and it remains in active development in 2026.
Magika’s custom model was trained and evaluated on a dataset of about 100 million files and weighs only a few megabytes, exported in ONNX format for fast CPU inference. Unlike extension- or signature-based tools, it reads a small subset of a file’s content and reasons about what the file actually is, which makes it especially strong on text formats such as source code, markup, and configuration files. A per-content-type threshold system decides when to trust a prediction or fall back to a generic label, and prediction modes let callers trade confidence against coverage. Google also ships integrations used by VirusTotal and abuse.ch.
Magika is completely free and open source under the Apache-2.0 license.
Magika is for security teams, platform engineers, and developers who need reliable content-type detection for uploads, malware triage, content routing, or data pipelines. Its tiny footprint and millisecond latency make it practical to drop into everything from mail gateways and cloud storage scanners to desktop utilities and CI checks.