Magika by Google

Summary

Magika is a novel AI-powered file type detection tool from Google that uses deep learning to identify file types accurately within milliseconds, even on a single CPU. Its custom, highly optimized model weighs only a few MBs and achieves around 99% average precision and recall.

Key Features

AI-powered file type detection using deep learning
Trained on ~100M samples across 200+ content types
~99% average precision and recall on the test set
About 5 ms inference per file on a single CPU
Near-constant inference time regardless of file size
Three prediction modes to control error tolerance
Batch processing of thousands of files with recursive directory scanning
Available as a Rust CLI, Python API, and Rust, JavaScript/TypeScript, and Go bindings
Open source with a web demo that runs locally in the browser
Used at scale by Google for Gmail, Drive, and Safe Browsing file routing

About Magika by Google


Trained and evaluated on about 100 million samples across more than 200 binary and textual content types, Magika takes about 5 ms per file after the model loads, with near-constant inference time regardless of file size since it reads only a subset of each file's bytes. It offers three prediction modes to control error tolerance and a per-content-type threshold system that returns generic labels when it cannot trust a prediction.


Available as a Rust command line tool, a Python API, and bindings for Rust, JavaScript/TypeScript, and Go, it is open source and used at scale by Google to route Gmail, Drive, and Safe Browsing files to security scanners, and is integrated with VirusTotal and abuse.ch. A web demo runs locally in the browser with no installation.

Get more likes & reach the top of search results by adding this button on your site!

Embed button preview - Light theme
Embed button preview - Dark theme
TurboType Banner

Subscribe to the AI Search Newsletter

Get top updates in AI to your inbox every weekend. It's free!