cheatsheet / current

Packet Diagram

Use Mermaid packet-beta to describe packet structures, nested headers, and byte-oriented layouts.

Packet Diagram

Use Mermaid packet-beta to describe packet structures, nested headers, and byte-oriented layouts.

Basic template

packet-beta
    0-7: "Version"
    8-15: "Type"

Core syntax

  • Start with packet-beta
  • Define bit or byte ranges with start-end: "Label"
  • Keep fields in order
  • Use short labels so the packet remains readable

Common example

packet-beta
    0-3: "Version"
    4-7: "IHL"
    8-15: "DSCP/ECN"
    16-31: "Total Length"
    32-47: "Identification"
    48-63: "Flags/Offset"
    64-71: "TTL"
    72-79: "Protocol"
    80-95: "Checksum"

Good for

  • Network protocol notes
  • Binary file format notes
  • Low-level systems documentation

Watch for

  • This diagram is specialized and easy to overuse
  • For logical relationships between components, architecture or flowchart is usually better