Kaitai Struct: declarative binary format parsing language
Posted by jpluimers on 2025/09/18
I don’t have words to describe how cool this tool is: [Wayback/Archive] Kaitai Struct: declarative binary format parsing language:
A new way to develop parsers for binary structures.
Declarative: describe the very structure of the data, not how you read or write it
Language-neutral: write once, use in all supported languages:
- C++/STL
- C#
- Go *
- Java
- JavaScript
- Lua
- Nim *
- Perl
- PHP
- Python
- Ruby
* entry-level support
Packed with tools and samples: includes a compiler, an IDE, a visualizer and massive library of popular formats
Free & open source: feel free to use, modify and join the project
It’s actually not new any more as the project started in 2016, but it is versatile and complete especially for a version 0.10 (at the time of writing).
Quite a few years back I bumped into it, but back then it was not up to what I needed, like the very small set of other tools at that time, so I did a tedious manual job.
A while ago a friend asked for reverse engineering file formats, so I found it back via [Wayback/Archive] Tools to help reverse engineer binary file formats – Stack Overflow (thanks [Wayback/Archive] Mat and [Wayback/Archive] Thomas Tempelmann)
More tools from that question:
- [Wayback/Archive] vstinner/hachoir: Hachoir is a Python library to view and edit a binary stream field by field
- [Wayback/Archive] Thomas Tempelmann – iBored
- [Wayback/Archive] Synalyze It! – More than a Hex Editor for macOS | Synalysis
More tools via [Wayback/Archive] tools reverse engineering file formats – Google Search:
- [Wayback/Archive] Reverse Engineering/File Formats – Wikibooks, open books for an open world
- [Wayback/Archive] How to Reverse Engineer a Proprietary File Format: A Brief Guide with Practical Examples | Apriorit
Back to Kaitai
Kaitain is hosted at GitHub and consists of a tree of repositories:
- [Wayback/Archive] kaitai-io/kaitai_struct: Kaitai Struct: declarative language to generate binary data parsers in C++ / C# / Go / Java / JavaScript / Lua / Nim / Perl / PHP / Python / Ruby
- [Wayback/Archive] kaitai_struct_compiler — compiler that translates
.ksyinto a parser source code written in a target programming language - [Wayback/Archive] kaitai_struct_tests — tests & specs to ensure that compiler work as planned
- Runtime libraries
- [Wayback/Archive] kaitai_struct_cpp_stl_runtime — for C++/STL
- [Wayback/Archive] kaitai_struct_csharp_runtime — for C#
- [Wayback/Archive] kaitai_struct_java_runtime — for Java
- [Wayback/Archive] kaitai_struct_javascript_runtime — for JavaScript
- [Wayback/Archive] kaitai_struct_nim_runtime — for Nim
- [Wayback/Archive] kaitai_struct_lua_runtime — for Lua
- [Wayback/Archive] kaitai_struct_python_runtime — for Python
- [Wayback/Archive] kaitai_struct_ruby_runtime — for Ruby
- [Wayback/Archive] kaitai_struct_swift_runtime — for Swift
- [Wayback/Archive] kaitai_struct_formats — library of widely used formats and binary structures described as
.ksyfiles
- [Wayback/Archive] kaitai_struct_compiler — compiler that translates
At thee time of writing, these repositories are not mentioned in the [Wayback/Archive] kaitai_struct/README.md at master · kaitai-io/kaitai_struct but are present in the repository or [Wayback/Archive] Kaitai team/organisation:
- [Wayback/Archive] kaitai-io/kaitai_struct_benchmarks: Kaitai Struct: benchmarking suite
- [Wayback/Archive] kaitai-io/kaitai_struct_doc: Kaitai Struct: documentation
- [Wayback/Archive] kaitai-io/kaitai_struct_examples
- [Wayback/Archive] kaitai-io/kaitai_struct_gui: Kaitai Struct: visualizer and hex viewer tool GUI in Java
- [Wayback/Archive] kaitai-io/kaitai_struct_go_runtime: Kaitai Struct: runtime for Go
- [Wayback/Archive] kaitai-io/kaitai_struct_perl_runtime: Kaitai Struct: runtime for Perl
- [Wayback/Archive] kaitai-io/kaitai_struct_php_runtime: Kaitai Struct: runtime for PHP
- [Wayback/Archive] kaitai-io/kaitai_struct_rust_runtime: Kaitai Struct: runtime for Rust
- [Wayback/Archive] kaitai-io/kaitai_struct_samples: Kaitai Struct: library of sample files for testing
- [Wayback/Archive] kaitai-io/kaitai_struct_typescript_runtime: Kaitai Struct: Runtime for Typescript
- [Wayback/Archive] kaitai-io/kaitai_struct_visualizer: Kaitai Struct: visualizer and hex viewer tool
- [Wayback/Archive] kaitai-io/kaitai_struct_webide: Online editor / visualizer for Kaitai Struct .ksy files
- [Wayback/Archive] kaitai-io/kaitai_struct_webide_docs: Docs repo for the WebIDE (bigger files & stuff)
- [Wayback/Archive] kaitai-io/kaitai_struct_webide_vue: The kaitai struct webide completely rewritten from the ground up with vuejs and web components
This was known: [Wayback/Archive] A few questions on the language repositories and supported languages mentioned README.md · Issue #1010 · kaitai-io/kaitai_struct and related to [Wayback/Archive] Add C++ usage example in README.md by generalmimon · Pull Request #738: issuecomment-619357771 · kaitai-io/kaitai_struct.
The Katai chosen solution was to move away from text based code examples to HTML based ones: tedious to edit, hard to get right and impossible to link to individual examples. But alas: they are in a central place now:
- [Wayback/Archive] Remove KSY file and code snippets from README, link to kaitai.io instead by pfroud · Pull Request #1018 · kaitai-io/kaitai_struct
- [Wayback/Archive] Remove KSY file and code snippets from README, link to kaitai.io instead by pfroud · Pull Request #1018 · kaitai-io/kaitai_struct: files
- [Wayback/Archive] Kaitai Struct: declarative binary format parsing language: quick start
–jeroen






Leave a comment