Skip to content
MermaidViewer

AI packet diagram generator

AI packet diagram generator for protocol headers. Describe the fields and bit widths, get a Mermaid packet diagram.

By MermaidViewer editorsPublished Updated

Free · 5 uses total, not a daily refill. No sign-up.

Example prompts for a packet diagram

  • “IPv4 header”
  • “Custom binary message format for an IoT sensor”
  • “DNS message header”

What a Mermaid packet diagram looks like

Example packet diagram

Example packet diagram diagram
mermaid
packet
    title UDP header
    0-15: "Source port"
    16-31: "Destination port"
    32-47: "Length"
    48-63: "Checksum"
    64-95: "Data (variable length)"
Open in the live editor

Want to write it by hand? See the full Mermaid packet diagram syntax and examples, or browse templates.

Bit ranges do not forgive a gap, so an ai packet diagram generator is only finished when every bit from the start of a row to the end of that row belongs to a field. A DNS header, a telemetry frame, a custom log record: the drawing is a ruler. The widget above writes Mermaid packet syntax. This page is about widths you state in bits, the overlaps models insert, and the one-field edits you should do by hand.

Headers it can lay out

Contiguous ranges survive when you list them in order and give the start and end bit. A title sticks. Multi-byte fields that you describe as "the next 32 bits" become a range like 32-63 if the earlier rows really did end at bit 31. Single-bit flags work when you name the bit index, 16: "QR", instead of saying "a flag" and hoping. The diagram looks like an RFC figure, which is what you want in a lab or a protocol note.

The model is good at a short header, four to eight fields, with widths that are nibbles or bytes. It is worse at options and padding, where the length is variable. Say "fixed part only" unless you are ready to specify the option layout. The safe keyword is packet-beta. Current Mermaid also accepts packet. Keep the beta keyword if the file will be pasted into a tool that has not caught up.

The packet diagram reference shows start-end: "Label" and a single-bit form. Rows are 32 bits wide in the classic drawing. Your ranges can cross a row. A field from bit 0 through 31 is one row. A field from 0 through 15 sits on the left of the first row. The picture lies if those numbers lie.

Ranges that overlap or skip

The model restarts at bit 0 for every field, so four "16-bit" fields all claim 0-15 and paint on top of each other. Or it leaves a hole: version occupies 0-3, then traffic class starts at 8, and bits 4 through 7 belong to nobody. Flags get written as words without a width, Flags: "control", and the parser drops the line. A field wider than the remaining bits of a mental row is fine if the numbers are explicit, and confusing if the prompt said "then a byte" without adding.

Another botch is a flowchart of boxes labeled with bit names. That is not a header. Totals that do not match the header size you stated, "this is a 20-byte header" with ranges that stop at bit 95, are a design error that still renders. Check the last bit. 20 bytes is bits 0 through 159.

The IPv4 header template already has version, IHL, DSCP, total length, identification, flags, fragment offset, TTL, protocol, checksum, and the addresses. Generate a new figure for DNS, a telemetry frame, or a log record. Open the template when the assignment is the IPv4 header and you are adding options. Do not ask the model to "remember the RFC." Give it the bits.

Widths the prompt should list

Speak in bit indexes.

  • The title, including the header name.
  • The keyword packet-beta.
  • Each field in order: start bit, end bit, label.
  • Single-bit fields called out as one index.
  • The last bit you expect, so the total width is checkable.
  • A ban on fields you are not drawing yet, such as options or a payload.
  • Labels free of stray quotes.

The prompt guide explains editing a generation. On packet diagrams, "renumber so the next field starts at the previous end plus one" is the edit that fixes a pile-up on bits 0-15.

Three prompts

  • Packet diagram titled DNS header, fixed 12 bytes, packet-beta. Bits 0-15 ID. 16-31 flags. 32-47 question count. 48-63 answer count. 64-79 authority count. 80-95 additional count. No question section. No overlaps. The last bit is 95.
  • Packet diagram titled Sensor frame, packet-beta. Bits 0-7 version. 8-15 type. 16-31 device id. 32-63 timestamp seconds. 64-79 temperature. 80-95 crc. Do not draw a payload. Fields must be contiguous from 0 through 95.
  • Packet diagram titled Audit log record, packet-beta, first 8 bytes only. Bits 0-7 magic. 8-15 version. 16-47 event code. 48-63 length of the following payload, the length field only, not the payload bytes. Last bit 63. No flowchart. Labels in double quotes.

A DNS header with no hole

Each range starts where the previous one ended. The header is 96 bits, which is 12 bytes. Flags are a single 16-bit field here. Split them later if the class needs QR, opcode, and rcode as separate bits.

Mermaid diagram
mermaid
packet-beta
    title DNS header
    0-15: "ID"
    16-31: "Flags"
    32-47: "QDCOUNT"
    48-63: "ANCOUNT"
    64-79: "NSCOUNT"
    80-95: "ARCOUNT"
Open in the live editor

Open the editor and replace Flags with the individual flag bits only when you are ready to name each index. Bit 16 as QR, then opcode, then the rest, is a different figure. Do it as a hand edit so the counts below do not get renumbered by accident. If you insert 16 bits, every later start and end has to move.

Renumbering a header that stacked on zero

Use an AI edit when several ranges share a start bit or the diagram came back as a flowchart. "packet-beta. DNS header. ID 0-15, flags 16-31, QDCOUNT 32-47, ANCOUNT 48-63, NSCOUNT 64-79, ARCOUNT 80-95. No overlaps. No payload." Rebuilding the ruler is worth a generation. Remembering six pairs of indexes while you also fix syntax is how a hole sneaks back in.

Edit one range by hand when the rest of the ruler is contiguous. Change "Flags" to "Flags and codes" only if the width stays 16-31. To split a field, replace one line with several lines whose indexes meet, and shift every later field yourself. Hand editing stays free. Packet source is arithmetic. You can add the last end bit to one and check it equals the next start bit.

A parse error usually means a range written backwards, 15-0, or a label with an extra quote. A single bit is 16: "QR" without a second number. Fix the line the banner points at in the editor. Do not regenerate a correct ID field to repair a quote on CRC.

Five drafts, then the keyboard

The free tier is five AI uses in total. They are not a daily allowance. The account, the IP, and a device cookie are all tallied, and the fullest tally wins. A short header with explicit ranges often works on the first try. It needs a second try when every field claims bits 0-15. Take that try and restate the starts. Then adjust a label by typing.

Pricing lists Starter at $6.99 a month, which includes 500 AI conversations a month, and Pro at $11.99 a month, which includes unlimited AI under fair use. Fair use stops unattended volume. It is not a meter on hand editing, and hand editing stays free after the five uses are spent. Export stays available. A header figure can be corrected in review by editing indexes.

A block diagram is a grid of systems. A packet diagram is a grid of bits. If you wanted boxes for services, use the block generator linked from the AI diagram generator hub. Stay on this page when the unit is the bit.

Frequently asked questions

How do I generate a packet diagram with AI?

Describe the packet diagram you need in the box above and click Generate. The AI writes valid Mermaid packet diagram code that renders instantly, and you can open it in the editor to refine it.

Is the AI packet diagram generator free?

You can try it free: 5 AI generations in total, not per day, with no sign-up. Starter includes 500 AI conversations a month and Pro is unlimited. Manual editing stays available, and every plan can still download a PNG. JPG, SVG and PDF are on Pro.

Can I edit the generated packet diagram?

Absolutely. The output is plain Mermaid code — edit it by hand in the live editor, or ask the AI for changes in natural language.

Other AI generators