↓Skip to main content
  1. Blog/

What Is a DBC File? The CAN Database Format Explained

·6 mins

A CAN bus carries frames: an identifier and up to 8 bytes of payload, or up to 64 bytes with CAN FD. Nothing in the frame says what those bytes mean. A DBC file is the missing description. It names each message, lists the signals packed into its payload, and says how to turn the raw bits into a physical value such as engine speed in rpm.

The format was created by Vector Informatik for its CANdb++ tools and has become the de facto way to exchange CAN network descriptions. Almost every CAN analyser, logger, and code generator reads it.

A minimal DBC file #

A DBC file is plain text. This one defines two nodes and one message with three signals:

VERSION ""

BU_: ECM Dashboard

BO_ 256 EngineData: 8 ECM
 SG_ EngineSpeed : 0|16@1+ (0.25,0) [0|16383.75] "rpm" Dashboard
 SG_ CoolantTemp : 16|8@1+ (1,-40) [-40|215] "degC" Dashboard
 SG_ Gear : 24|3@1+ (1,0) [0|7] "" Dashboard

CM_ SG_ 256 EngineSpeed "Crankshaft speed, averaged over 10 ms";
VAL_ 256 Gear 0 "Park" 1 "Reverse" 2 "Neutral" 3 "Drive" ;

Each line starts with a keyword that says what it defines.

Nodes: BU_ #

BU_ lists the nodes (ECUs) on the network. Messages name one of them as the transmitter, and signals name the nodes that receive them. A message or signal with no known node uses the placeholder Vector__XXX.

Messages: BO_ #

BO_ 256 EngineData: 8 ECM

The fields are the CAN identifier in decimal, the message name, the payload length in bytes, and the transmitting node.

Standard 11-bit and extended 29-bit identifiers share the same field. An extended identifier is stored with bit 31 set, so the extended ID 0x18FEF100 appears in the file as 2566844672, which is 0x98FEF100.

Signals: SG_ #

 SG_ EngineSpeed : 0|16@1+ (0.25,0) [0|16383.75] "rpm" Dashboard

This is the line that does the real work. Reading left to right:

PartMeaning
EngineSpeedSignal name
0Start bit
16Length in bits
@1Byte order: 1 is little-endian (Intel), 0 is big-endian (Motorola)
+Unsigned; - means signed two’s complement
(0.25,0)Factor and offset
[0|16383.75]Minimum and maximum physical value
"rpm"Unit
DashboardReceiving nodes, comma-separated

The physical value is raw × factor + offset. The minimum and maximum are documentation: nothing in the format enforces them, and many files leave them as [0|0].

The start bit is the part that causes the most confusion, because its meaning depends on the byte order. We cover it in DBC start bits: Intel vs Motorola byte order.

Decoding a frame by hand #

Suppose this frame arrives with identifier 256:

A0 0F 5A 03 00 00 00 00
  • EngineSpeed starts at bit 0, is 16 bits long, and is little-endian, so it occupies bytes 0 and 1 with byte 0 as the low byte. Raw value 0x0FA0 is 4000, and 4000 × 0.25 gives 1000 rpm.
  • CoolantTemp is the 8 bits of byte 2. Raw value 0x5A is 90, and 90 − 40 gives 50 °C.
  • Gear is the low 3 bits of byte 3. Raw value 3 maps to Drive in the value table.

Value tables: VAL_ #

VAL_ attaches names to raw values of one signal, which is how an enumeration such as a gear position or an error code is described. VAL_TABLE_ defines a named table that is not tied to a signal.

Comments: CM_ #

CM_ attaches free text to the network, a node (BU_), a message (BO_), or a signal (SG_). Comments can span several lines and end at the closing ";.

Multiplexed signals #

When a message carries different content depending on a selector field, the selector is marked M and each dependent signal is marked m followed by the selector value that activates it:

BO_ 512 Diagnostics: 8 ECM
 SG_ Page M : 0|8@1+ (1,0) [0|255] "" Dashboard
 SG_ OilPressure m0 : 8|16@1+ (0.1,0) [0|1000] "kPa" Dashboard
 SG_ FuelRate m1 : 8|16@1+ (0.05,0) [0|3200] "l/h" Dashboard

OilPressure and FuelRate share the same bits. Which one is present depends on the value of Page. Extended multiplexing, with nested selectors or value ranges, is described by additional SG_MUL_VAL_ lines.

Attributes: BA_DEF_, BA_DEF_DEF_, BA_ #

Attributes are typed key-value pairs that tools use to store everything the core syntax does not cover. BA_DEF_ declares an attribute and its type, BA_DEF_DEF_ sets its default, and BA_ assigns a value to a specific object.

The best-known example is GenMsgCycleTime, which holds the transmission period of a message in milliseconds:

BA_DEF_ BO_ "GenMsgCycleTime" INT 0 65535;
BA_DEF_DEF_ "GenMsgCycleTime" 100;
BA_ "GenMsgCycleTime" BO_ 256 10;

Attribute names are conventions rather than part of the format, so different toolchains expect different ones.

Other keywords you will meet #

  • VERSION — a free-text version string, often empty.
  • NS_ — a list of the keywords the file may use. Parsers generally ignore it.
  • BS_ — bus speed, almost always left empty.
  • BO_TX_BU_ — additional transmitters for a message.
  • SIG_VALTYPE_ — marks a signal as a 32-bit or 64-bit IEEE float instead of an integer.

Common pitfalls #

  • Motorola start bits. For big-endian signals the start bit is the position of the most significant bit, not the least significant one. Tools that display it differently lead to off-by-several-bits errors.
  • Text encoding. The format has no encoding declaration. Files written on Windows often use a legacy code page, so a degree sign or an umlaut in a unit or comment can turn into garbage when another tool assumes UTF-8.
  • Overlapping signals. Nothing in the syntax prevents two signals from claiming the same bits, or a signal from running past the end of the payload.
  • Lossy round trips. Many editors rewrite the whole file on save, reordering statements and dropping lines they do not understand. That makes version-control diffs unreadable and can silently remove vendor-specific data.

DBC is not the only CAN description format. KCD is an open XML format from the Kayak project, SYM is used by PEAK-System tools, DBF by BUSMASTER, and ARXML is the AUTOSAR system description, which covers far more than CAN. Converting between them is routine, though each can express things the others cannot.

Working with DBC files on a Mac #

We build DBC Craft, a native Mac editor for DBC files. It shows every signal on a colour-coded bit grid, decodes and encodes frames, flags overlaps and out-of-range signals, and saves an unedited file back byte for byte. Reading and inspecting a database is free.

If you need help with CAN tooling or embedded software around it, get in touch.