Packet diagrams: fields and bits
Introduction
Packet diagrams are used to describe protocol header structures, byte layouts, and field semantics. This article compares PlantUML and Mermaid for drawing Packet diagrams.
PlantUML
1 | @startuml |
PlantUML uses the packet keyword to define a block, --- to separate field rows, and square brackets with a bit count for each field.
Mermaid
1 | packet-beta |
Mermaid uses packet-beta diagram type, defining fields by byte offset ranges (start-end), with a title keyword for the diagram title.
Side by side
| Feature | PlantUML | Mermaid |
|---|---|---|
| Engine keyword | packet |
packet-beta |
| Field definition | [Name] N bits |
start-end: Name |
| Grouping/separator | --- horizontal line |
none (natural line break) |
| Bit offset precision | no offset shown, only width | start and end offset required |
| Annotation support | inline [Name] comment |
title keyword |
Wrap-up
PlantUML’s Packet diagrams suit abstract-level descriptions and semantic grouping; Mermaid’s packet-beta is better for precise byte-offset layouts. Both can be embedded in docs or blogs — choose based on whether you need “coarse-grained description” or “exact bit layout”.
- Title: Packet diagrams: fields and bits
- Author: puml.online
- Created at : 2026-10-06 09:00:00
- Updated at : 2026-12-06 10:29:22
- Link: https://puml.online/en/blog/packet-beta-fields/
- License: This work is licensed under CC BY-NC-SA 4.0.