Mermaid Block Diagram Maker
Write block diagrams in Mermaid code and watch them render as you type. Start from the example below, then export PNG or SVG, share a link or embed the diagram.
Updated · Code editor with live preview
Block diagram example
Rendering preview…
block-beta
columns 3
browser["Browser"] api["API"] db[("Database")]
space:3
cdn["CDN"] queue["Job queue"] cache[("Cache")]
browser --> api
api --> db
api --> cacheWhat is a block diagram?
A block diagram arranges labelled boxes on a grid and draws arrows between them. Unlike a flowchart, which lays itself out automatically, a block diagram lets you say how many columns there are and where the gaps go. In Mermaid you write one as text starting with the block-beta keyword.
When to use a block diagram
- System and service architecture drawings
- Hardware or network layouts
- Layered diagrams where position means something
- Slides where a flowchart lays itself out badly
How to make a block diagram in Mermaid
- Step 1
Open the editor
Open TryMermaid with the example on this page, or start a new diagram with block-beta on the first line.
- Step 2
Set the grid
Set the grid width with a columns line, such as columns 3, then list blocks in the order they should fill the grid.
- Step 3
Position and connect
Use space or space:3 to leave gaps, and connect blocks with arrows such as browser --> api.
- Step 4
Export or share
Check the live preview, then export as PNG or SVG or copy a share link.
Block diagram syntax cheat sheet
| Element | Syntax | What it does |
|---|---|---|
| Start | block-beta | Begins a block diagram |
| Grid width | columns 3 | How many blocks per row |
| Block | api["API"] | A labelled box |
| Cylinder | db[("Database")] | A datastore shape |
| Gap | space:3 | Leaves empty cells |
| Arrow | browser --> api | Connects two blocks |
| Wide block | gateway["Gateway"]:3 | Spans several columns |
Block diagram FAQ
What is the difference between a block diagram and a flowchart?
A flowchart lays itself out automatically and is about the order that steps happen in. A block diagram puts boxes on a grid you define with a columns line, which suits architecture drawings where position carries meaning.
How do I leave a gap in the grid?
Use a space line. space:3 leaves three empty cells, which is how you push the next row into the position you want.
Can blocks use different shapes?
Yes. The bracket shapes work as they do in flowcharts, so db[("Database")] draws a cylinder and a plain name draws a rectangle.