TestBench.tools

CAN Frame Decoder

Break down CAN 2.0 frames: ID, DLC, data bytes, flags.

Identifier (11-bit standard)
0x123
Identifier (binary — lower wins arbitration)
00100100011
Identifier (decimal)
291
DLC
4
Data
DE AD BE EF

This tool breaks a CAN 2.0 frame into its logical fields: the identifier rendered in hex, decimal and full-width binary (11- or 29-bit), the DLC, and the data bytes — with validation of identifier range, data length and RTR consistency. The binary view exists for a reason: arbitration priority reads directly off those bits.

How it works

A classic CAN data frame carries an identifier (11-bit standard or 29-bit extended, selected by the IDE bit), a 4-bit DLC declaring 0–8 data bytes, the data itself and a CRC handled by the controller. The identifier doubles as the bus priority: IDs transmit MSB-first with dominant zeros, so the lowest number wins arbitration without any collision loss. This tool validates your fields against those structural rules and displays the identifier padded to its full bit width — the form you need when assigning priorities or configuring acceptance filters.

Worked example

ID 0x123 (standard) · data DE AD BE EF
binary 00100100011 (11-bit) · decimal 291 · DLC 4
0x0FF would beat 0x123 on the bus — earlier dominant bit

Parameters

ParameterValueNotes
Standard ID11-bit, 0x000 … 0x7FF
Extended ID29-bit, 0 … 0x1FFFFFFFIDE bit set
DLC0 … 8 bytesclassic CAN 2.0
Prioritylower ID winsMSB-first, dominant 0
RTRremote requestno data field

C reference

C
#include <stdint.h>

/* Typical received-frame struct on MCU CAN drivers */
typedef struct {
    uint32_t id;        /* 11-bit: 0..0x7FF, 29-bit: 0..0x1FFFFFFF */
    uint8_t  extended;  /* IDE flag */
    uint8_t  rtr;       /* remote frame */
    uint8_t  dlc;       /* 0..8 data bytes */
    uint8_t  data[8];
} can_frame_t;

int can_id_valid(const can_frame_t *f)
{
    return f->id <= (f->extended ? 0x1FFFFFFFu : 0x7FFu);
}

FAQ

What's the difference between 11-bit and 29-bit identifiers?

CAN 2.0A uses an 11-bit identifier (0x000–0x7FF); CAN 2.0B extends it to 29 bits (0x00000000–0x1FFFFFFF) by adding an 18-bit extension. Both can coexist on one bus. Automotive OBD-II diagnostics, for example, conventionally uses 11-bit IDs like 0x7DF/0x7E8.

Why does a lower identifier win arbitration?

CAN bits are dominant (0) or recessive (1). During simultaneous transmission each node monitors the bus; a node sending recessive but reading dominant loses and backs off. Since the ID transmits MSB first, the numerically lowest identifier — the one with the earliest 0 — always wins. That is why the binary view here matters for priority planning.

What is DLC exactly?

The Data Length Code, 0–8 in classic CAN, declaring how many data bytes follow. This tool derives it from the bytes you enter. (CAN FD reuses DLC codes 9–15 for lengths up to 64 bytes — a different protocol generation.)

What is an RTR frame?

A remote frame: same identifier and DLC as a data frame but with the RTR bit recessive and no data field — it asks the producer of that identifier to transmit. Rarely used in modern designs, but still part of CAN 2.0.

Is my data uploaded?

No. Everything decodes locally in your browser.

Related tools