All diagram types Open editor

merIDK / Diagram types / Packet diagram

Mermaid packet diagram: example and syntax

Packet diagrams lay out the bit fields of a network packet or binary format. Engineers use them to document protocols such as TCP, UDP or their own file formats.

Open this example in the editor

Example code

---
title: "UDP header"
---
packet
0-15: "Source port"
16-31: "Destination port"
32-47: "Length"
48-63: "Checksum"
64-95: "Data (variable)"

Result

---
title: "UDP header"
---
packet
0-15: "Source port"
16-31: "Destination port"
32-47: "Length"
48-63: "Checksum"
64-95: "Data (variable)"

Syntax quick reference

How to use it

  1. Open the example in the editor, or paste your own Mermaid code.
  2. Edit the code on the left. The preview updates as you type, and errors point to the line.
  3. Export SVG or PNG, copy a Markdown block for GitHub or Notion, or copy a share link.

More diagram types