Matter Protocol Codec
Decode and encode Matter TLV data for smart home development
Paste TLV data captured from Matter devices or protocol analyzers
Click to Load Example
Decoded Result
Enter TLV data and click Decode to see results
Byte Viewer
Define TLV elements using JSON notation with type annotations
Click to Load Encode Example
Define your data structure using C/C++ syntax. Use // tag N comments to specify TLV tags.
Parsed Schema
Fill in Field Values
Encoded Result
Enter JSON and click Encode to generate TLV data
Byte Viewer
Encoding Statistics
Enter a Matter QR code string (MT:...) or manual pairing code (11/21 digits)
Click to Load Example
Parsed Onboarding Information
Enter a QR code string or manual pairing code to parse
Basic Information
Range: 1-99999998. Invalid: 0, 11111111, 22222222, etc.
Commissioning Flow
Discovery Capabilities
Output Format
Generated Payload
Fill in the parameters and click Generate
TLV Element Types
| Type Name | Type Code | Value Size |
|---|---|---|
| Signed Int | 0x00-0x03 | 1, 2, 4, 8 bytes |
| Unsigned Int | 0x04-0x07 | 1, 2, 4, 8 bytes |
| Boolean | 0x08-0x09 | 0 bytes |
| Float | 0x0A | 4 bytes |
| Double | 0x0B | 8 bytes |
| UTF-8 String | 0x0C-0x0F | 1/2/4/8-byte length + data |
| Byte String | 0x10-0x13 | 1/2/4/8-byte length + data |
| Null | 0x14 | 0 bytes |
| Structure | 0x15 | End-of-Container (0x18) |
| Array | 0x16 | End-of-Container (0x18) |
| List | 0x17 | End-of-Container (0x18) |
| End of Container | 0x18 | 0 bytes |
Matter Protocol Technical Reference
C Struct Schema Usage Guide
The C Struct Schema mode allows you to define data structures using familiar C/C++ syntax. The parser extracts field names, types, and TLV tags from your struct definitions, then generates a visual form for easy data entry and TLV encoding.
Supported Syntax
// Supported syntax forms:
typedef struct { ... } StructName;
typedef struct Tag { ... } StructName;
struct StructName { ... };
Supported Data Types
| Category | C/C++ Types | TLV Type |
|---|---|---|
| Signed Integer | int8_t, int16_t, int32_t, int64_t, char, short, int, long | int (1-8B) |
| Unsigned Integer | uint8_t, uint16_t, uint32_t, uint64_t, unsigned char/short/int/long, size_t | uint (1-8B) |
| Boolean | bool, _Bool | bool |
| Floating Point | float, double | float/double |
| String | char[], char[N], char* | UTF-8 string |
| Byte Array | uint8_t[], uint8_t[N], uint8_t* | byte string |
Tag Annotation Methods
Use comments to specify TLV context tags for each field. If no tag is specified, tags are auto-assigned starting from 0.
uint8_t field1; // tag 0 uint16_t field2; // tag: 1 uint32_t field3; /* tag 2 */ @tag(3) uint64_t field4;
Array Support
Fixed-size arrays (e.g., uint32_t data[4]) and variable-size arrays (e.g., uint8_t data[]) are supported. The form will provide an "Add Item" button for dynamic array element management.
uint32_t subjects[4]; // Fixed-size array (max 4 items) uint8_t data[]; // Variable-size array
Current Limitations
- Preprocessor directives (#define, #ifdef) are not supported
- typedef aliases (e.g., typedef uint8_t BYTE) are not supported
- Enums, unions, and bit-fields are not supported
- Nested struct editing is limited to one level
- Anonymous structs are not supported
What is Matter
Matter is a unified connectivity standard for smart home devices, originally developed under the name Project CHIP (Connected Home over IP) by the Connectivity Standards Alliance (CSA). The standard enables interoperability across ecosystems such as Apple HomeKit, Google Home, Amazon Alexa, and Samsung SmartThings. Devices compliant with Matter communicate over Wi-Fi, Thread, and Ethernet networks, using IPv6-based transport protocols. Matter 1.0 was released in October 2022, and subsequent revisions have expanded the range of supported device types.
Matter TLV Encoding Format
Matter uses a compact Tag-Length-Value (TLV) binary encoding scheme to serialize structured data. The format is used extensively across the protocol stack, including in Interaction Model messages, device attestation data, and commissioning payloads. Each TLV element consists of a control byte that encodes both the element type and tag form, followed by tag bytes (if any), length (for variable-length types), and the value payload.
Control Byte Structure
The control byte is the first byte of every TLV element. The lower 5 bits specify the element type, and the upper 3 bits indicate the tag form. This compact encoding allows single-byte representation for small values and tags.
| Bit Field | Description |
|---|---|
| Bits [4:0] | Element type (Signed/Unsigned Integer, Boolean, Float, UTF-8 String, Byte String, Null, Structure, Array, List, End of Container) |
| Bits [7:5] | Tag form: 000 = Anonymous, 001 = Context-specific (1-byte tag), 010-110 = Profile-specific tags, 111 = Fully Qualified |
TLV Element Types
The element type field determines how the value portion is encoded. Integer types use 1, 2, 4, or 8 bytes. Boolean values are encoded directly in the type field with no value bytes. Strings and byte arrays carry a length prefix followed by the data.
Onboarding Payload Format
When commissioning a new Matter device, the setup information is encoded in a compact payload embedded within a QR code or expressed as a numeric manual pairing code. The QR code payload begins with the prefix "MT:" followed by a Base38 encoded binary string containing the version, vendor ID, product ID, commissioning flow, discovery capabilities, discriminator, and setup passcode.
Base38 Encoding
Matter QR code payloads use a Base38 character set (0-9, A-Z, -.) for efficient alphanumeric representation. This encoding was chosen to fit within the constraints of QR code alphanumeric mode while maximizing data density. Every group of 3 bytes is encoded into 5 Base38 characters.
Manual Pairing Code
The 11-digit manual pairing code provides a fallback commissioning method when QR code scanning is unavailable. It encodes the discriminator (short form), setup passcode, and a Verhoeff check digit. The 21-digit version additionally includes the vendor ID and product ID for custom commissioning flows.
Verhoeff Check Digit
The manual pairing code uses the Verhoeff algorithm for error detection. This algorithm detects all single-digit errors and most adjacent transposition errors, making it well-suited for human-entered numeric codes.
Development Use Cases
- Debugging Matter TLV payloads captured from device interactions
- Inspecting Interaction Model request and response messages
- Verifying commissioning payloads embedded in QR codes
- Validating device attestation certificate TLV structures
- Building test payloads for Matter protocol conformance testing
Specification References
The Matter specification is maintained by the Connectivity Standards Alliance (CSA). The TLV encoding format is defined in the Core Specification Appendix A. Onboarding payload encoding is covered in Section 5.1.
- Matter Core Specification - Download from CSA
- Open Source Repository - github.com/project-chip/connectedhomeip
- SDK Documentation - project-chip.github.io/connectedhomeip-doc
- Matter Developer Handbook - handbook.buildwithmatter.com
Related Tools
CBOR Codec
Encode and decode CBOR binary format with JSON conversion, hex viewer, and semantic tag support for IoT development
Protocol Buffers Tool
Online Protocol Buffers encoder/decoder. Parse .proto schemas, encode JSON to binary, or decode binary to JSON
MQTT Codec
Encode and decode MQTT protocol packets with detailed field breakdown, hex viewer, and packet builder
ECDSA Signature Tool
Generate ECDSA key pairs, sign messages, and verify signatures with secp256k1, P-256, P-384, P-521 curves