# How to Customize Magika in MarkItDown: 4 Proven Methods

> Learn how to customize Magika in MarkItDown with 4 proven methods. Explore subclassing, patching, and monkey-patching for flexible file identification.

- Repository: [Microsoft/markitdown](https://github.com/microsoft/markitdown)
- Tags: how-to-guide
- Published: 2026-04-11

---

**Yes, you can customize Magika in MarkItDown by subclassing the `MarkItDown` class to inject a custom `magika.Magika` instance, patching the `_magika` attribute after construction, or monkey-patching `identify_stream` globally.**

MarkItDown, Microsoft's open-source document conversion tool, relies on the Magika library to sniff MIME types, file extensions, and character encodings before routing streams to the appropriate converter. While the default configuration handles most workloads, the integration points in `packages/markitdown/src/markit