Apache Avro Object Container File
Row-oriented binary data serialization container widely used in Kafka/Confluent event streaming and Iceberg manifest lists, embedding full JSON writer schema in the file header.
Begins with `Obj\x01` (`4F 62 6A 01`), followed by a ZigZag varint-encoded metadata map (`avro.schema`, `avro.codec`) and a 16-byte random sync marker repeated after every block.
Drop any .avro file (even 100 GB+) to inspect locally
Reads tiny File.slice() header/footer pages in a sandboxed Web Worker · 0 Bytes Uploaded
.avro Magic Bytes & Header Offset Map
Avro Object Container v1 magic ('O','b','j', 0x01)
| Byte Offset | Length | Data Type | Field Name | Engineering Description |
|---|---|---|---|---|
| 0x00 - 0x03 | 4 B | uint8[4] | magic | 'Obj\x01' container signature |
| 0x04+ | var | avro_map | file_metadata | ZigZag varint map containing avro.schema & avro.codec |
| hdr_end-16 | 16 B | uint8[16] | sync_marker | 16-byte random block boundary sync token |
.avro Security & Polyglot Risk Matrix
Validate `Obj\x01` prefix and cap maximum `avro.schema` JSON recursion depth and block decompression size.
Read .avro Header & Metadata Without Heavy Dependencies
import sys
with open(sys.argv[1], "rb") as f:
buf = f.read(4096)
assert buf[:4] == b"Obj\x01"
has_schema = b"avro.schema" in buf
print(f"Avro v1 container, embedded_schema={has_schema}")Deterministic .avro Sample Files & Edge Cases
minimal-null.avro
Real Avro OCF from fastavro with embedded record schema, null codec, and 16-byte sync markers.
curl -fsSL https://fileformat.co/fixtures/v1/avro/minimal-null.avro -o minimal-null.avro \
&& echo "8f5420609b6bb63e55d37521ce5163e81467a3ec798784bf5857e3c4131acdfd minimal-null.avro" | shasum -a 256 -cevents-deflate.avro
fastavro-written OCF with deflate-compressed block of 10 UserEvent records.
curl -fsSL https://fileformat.co/fixtures/v1/avro/events-deflate.avro -o events-deflate.avro \
&& echo "bc90476179aca51aae52611b266a87a02d16fd5392fa551554874ce3218f341a events-deflate.avro" | shasum -a 256 -ccorrupted-sync-marker.avro
Avro block cut off mid-sync-marker — fastavro reader must raise on block-boundary failure.
curl -fsSL https://fileformat.co/fixtures/v1/avro/corrupted-sync-marker.avro -o corrupted-sync-marker.avro \
&& echo "6534e49af5871a7f976a650fb164f50be0a9231d34ec2a6e46600354ca5da803 corrupted-sync-marker.avro" | shasum -a 256 -cRelated Specifications & Alternatives
De-facto standard hybrid columnar storage format for modern data lakes (Iceberg, Delta, DuckDB, Spark), placing Thrift Compact Protocol schema and statistics in the file trailer.
Stripe-based columnar storage format originating in the Hive/Trino/Presto ecosystem with Protobuf-encoded Footer and a 1-byte PostScript length at the very last byte of the file.
Streaming line-oriented text format where every newline-separated record is a standalone UTF-8 JSON value—standard for LLM fine-tuning (SFT/DPO) datasets and batch APIs.