Avro Decoder
Avro Data
Schema (.avsc)
Decoded
What this tool does
Paste binary Avro as hex or base64, put the schema it was written with in the Schema box, and see the data as JSON. Everything runs in your browser, so the data and the schema never leave your computer.
- Kafka records written with Confluent Schema Registry start with a 5-byte header: the tool removes it and shows the schema ID.
- Avro files (
.avro) carry their schema inside: press Open file or drop one on the data box, and the schema fills itself in. Files compressed with deflate or snappy open too. - The schema is checked as you type. If it’s not valid, the box above it says what’s wrong and where.
The output has three views. JSON is what you’d want to read: unions unwrapped, dates as dates, decimals as numbers. Avro JSON is Avro’s own JSON encoding, one record per line, which Avro’s tools read back. Annotated shows every value with its type and the bytes it came from, so when a schema doesn’t fit the data you can see where it starts to go wrong.
Why Avro needs the schema
Avro’s binary format is as small as it is because it leaves almost everything out. There are no field names, no field numbers and no types in the data: only the values, one after another, in the order the schema lists the fields. The example record starts like this:
| Bytes | Read as, with the schema |
|---|---|
10 |
id is a string, so this is its length: 16, zigzag-encoded, is 8 |
4f 52 44 2d 31 30 34 32 |
the 8 bytes of ORD-1042 |
92 b3 09 |
customer_id is a long: 154,002, zigzag-encoded, is 77,001 |
04 |
status is an enum: index 2, SHIPPED |
04 |
items is an array: a block of 2 items follows |
Read with another schema, the same bytes mean something else, so decoding needs the exact schema the data was written with. (Avro lets a reader use a newer version of the schema, but only by resolving it against the writer’s.) When the schema is wrong, decoding usually fails partway; the error says at which field and which byte, and the Annotated view shows what was read up to there.
Kafka records and Schema Registry
A record serialized with Confluent’s Avro serializer starts with byte 00, then the schema’s ID in the next four bytes (big-endian), then the Avro data. The example is one: 00 00 00 00 2a is schema ID 42. The tool finds the header, removes it and shows the ID next to the byte count.
To get the schema for an ID, ask Schema Registry and paste its answer as it is; the tool reads the schema inside it. In these commands, put your registry’s address in place of localhost:8081 and your topic in place of orders:
curl http://localhost:8081/schemas/ids/42
# or the latest version for a topic's values
curl http://localhost:8081/subjects/orders-value/versions/latestTo get a record’s bytes, kcat can print a value as it is, which xxd turns into hex: kcat -C -b localhost:9092 -t orders -c 1 -f '%s' | xxd -p.
Avro files
An .avro file (an object container file) starts with Obj and a header holding the schema and the compression codec, then blocks of records. Open one with Open file, or drop it on the data box: the schema from the file goes into the Schema box, and every record is decoded with it, up to the first 1,000. Files compressed with deflate or snappy open; for zstandard, bzip2 or xz, use avro-tools tojson.
JSON or Avro JSON
The two JSON views differ where Avro has more types than JSON:
| JSON | Avro JSON | |
|---|---|---|
| A union | the value: "WINTER10" |
the value inside its type: {"string": "WINTER10"} |
| A null in a union | null |
null |
bytes and fixed |
base64 | a string with one character per byte |
A decimal |
the number, as a string: "12.99" |
its bytes |
A timestamp-millis |
the date: "2026-11-28T09:30:00Z" |
the number: 1795858200000 |
| Several records | an array | one record per line |
Avro JSON is what kafka-avro-console-producer and avro-tools fromjson read, so use it to send a record you’ve decoded back to Kafka, or into a test.
The same on the command line
# an .avro file, one record per line
java -jar avro-tools.jar tojson orders.avro
# a single record, with its schema
xxd -r -p record.hex > record.bin
java -jar avro-tools.jar fragtojson --schema-file order.avsc record.bin
# a topic that uses Schema Registry
kafka-avro-console-consumer --bootstrap-server localhost:9092 --topic orders \
--from-beginning --property schema.registry.url=http://localhost:8081FAQs
Can I decode Avro without the schema?
Not a single record. The bytes hold only values, without names or types, so without the schema there’s no telling where one value ends and the next begins. An.avro file carries its schema in its header, so it decodes on its own; a Kafka record from Schema Registry carries the ID of its schema, which you can fetch.Is my data sent anywhere?
No. Decoding happens in your browser, and files you open are read on your computer. Nothing is uploaded.Why does it say the data doesn’t fit the schema?
Usually because the record was written with another version of the schema: a field added, removed or moved. Avro reads values strictly in the writer’s order, so one difference shifts everything after it. Use the schema the producer used; for a Kafka record, the one with the record’s schema ID.How do I validate an Avro schema?
Paste it into the Schema box. It’s checked as you type, and the line above the box says what’s wrong and where: an unknown or misspelled type, a name used twice, a name with characters Avro doesn’t allow, a union with two types of the same kind, a record without a fields list. A valid schema shows its name and how many fields it has.How is this different from the Avro to JSON converter?
Avro to JSON makes sample JSON from a schema, without any data. This tool reads real Avro bytes: the records your producers write.Which logical types does it understand?
decimal, uuid, date, time-millis, time-micros, timestamp-millis, timestamp-micros, timestamp-nanos, the local-timestamp types and duration. The JSON view shows them as dates, times and numbers; Avro JSON keeps the values they’re stored as. A logical type that doesn’t fit its type (a decimal without a precision) is ignored, as the Avro spec says, and the Annotated view says why.