Block Diagrams in TikZ
Create system architecture diagrams, signal flow diagrams, and technical block diagrams.
Block Diagram Styles
\usetikzlibrary{shapes.geometric, arrows.meta, positioning, fit}
\tikzset{
block/.style={
draw, rectangle,
minimum width=2cm, minimum height=1cm,
text centered, fill=blue!10
},
sum/.style={
draw, circle,
minimum size=0.6cm,
inner sep=0pt
},
input/.style={coordinate},
output/.style={coordinate},
arrow/.style={-Stealth, thick},
line/.style={thick}
}Simple Block Diagram
\begin{tikzpicture}[node distance=2cm, auto]
% Blocks
\node[input] (input) {};
\node[block, right=of input] (system) {System};
\node[output, right=of system] (output) {};
% Connections
\draw[arrow] (input) -- node[above] {Input} (system);
\draw[arrow] (system) -- node[above] {Output} (output);
\end{tikzpicture}Feedback Control System
\begin{tikzpicture}[node distance=1.5cm, auto]
% Input
\node[input] (input) {};
% Sum junction
\node[sum, right=of input] (sum) {};
\node[above left=-2pt of sum] {$+$};
\node[below left=-2pt of sum] {$-$};
% Controller and Plant
\node[block, right=of sum] (controller) {Controller};
\node[block, right=of controller] (plant) {Plant};
% Output
\node[output, right=of plant] (output) {};
% Feedback
\node[block, below=of plant] (sensor) {Sensor};
% Connections
\draw[arrow] (input) -- node {$r$} (sum);
\draw[arrow] (sum) -- node {$e$} (controller);
\draw[arrow] (controller) -- node {$u$} (plant);
\draw[arrow] (plant) -- node[name=y] {$y$} (output);
\draw[arrow] (y) |- (sensor);
\draw[arrow] (sensor) -| (sum);
\end{tikzpicture}Signal Processing Chain
\begin{tikzpicture}[node distance=1.8cm]
% Signal processing blocks
\node[block] (adc) {ADC};
\node[block, right=of adc] (filter) {Filter};
\node[block, right=of filter] (fft) {FFT};
\node[block, right=of fft] (process) {Process};
\node[block, right=of process] (ifft) {IFFT};
\node[block, right=of ifft] (dac) {DAC};
% Input/output
\node[left=of adc] (in) {Analog In};
\node[right=of dac] (out) {Analog Out};
% Connect everything
\draw[arrow] (in) -- (adc);
\draw[arrow] (adc) -- node[above, font=\footnotesize] {Digital} (filter);
\draw[arrow] (filter) -- (fft);
\draw[arrow] (fft) -- node[above, font=\footnotesize] {Freq.} (process);
\draw[arrow] (process) -- (ifft);
\draw[arrow] (ifft) -- node[above, font=\footnotesize] {Time} (dac);
\draw[arrow] (dac) -- (out);
\end{tikzpicture}Parallel Processing Blocks
\begin{tikzpicture}[node distance=1.5cm]
% Input
\node[block] (input) {Input};
% Parallel blocks
\node[block, above right=1cm and 2cm of input] (proc1) {Process A};
\node[block, right=2cm of input] (proc2) {Process B};
\node[block, below right=1cm and 2cm of input] (proc3) {Process C};
% Merge
\node[block, right=2cm of proc2] (merge) {Merge};
% Output
\node[block, right=of merge] (output) {Output};
% Connections - split
\draw[arrow] (input.east) -- ++(0.5,0) |- (proc1.west);
\draw[arrow] (input.east) -- (proc2.west);
\draw[arrow] (input.east) -- ++(0.5,0) |- (proc3.west);
% Connections - merge
\draw[arrow] (proc1.east) -| ([xshift=-0.5cm]merge.west) -- (merge.west);
\draw[arrow] (proc2.east) -- (merge.west);
\draw[arrow] (proc3.east) -| ([xshift=-0.5cm]merge.west);
\draw[arrow] (merge) -- (output);
\end{tikzpicture}Layered Architecture
\begin{tikzpicture}
\tikzset{
layer/.style={
draw, rectangle,
minimum width=8cm, minimum height=1.2cm,
text centered
}
}
% Layers from bottom to top
\node[layer, fill=gray!30] (hw) at (0,0) {Hardware Layer};
\node[layer, fill=blue!20] (os) at (0,1.5) {Operating System};
\node[layer, fill=green!20] (rt) at (0,3) {Runtime Environment};
\node[layer, fill=yellow!20] (app) at (0,4.5) {Application Layer};
\node[layer, fill=red!20] (ui) at (0,6) {User Interface};
% Arrows between layers
\draw[<->, thick] ([xshift=-3cm]hw.north) -- ([xshift=-3cm]os.south);
\draw[<->, thick] ([xshift=-3cm]os.north) -- ([xshift=-3cm]rt.south);
\draw[<->, thick] ([xshift=-3cm]rt.north) -- ([xshift=-3cm]app.south);
\draw[<->, thick] ([xshift=-3cm]app.north) -- ([xshift=-3cm]ui.south);
\end{tikzpicture}Component Diagram with Groups
\usetikzlibrary{backgrounds, fit}
\begin{tikzpicture}[node distance=1.5cm]
% Frontend components
\node[block] (ui) {UI};
\node[block, right=of ui] (state) {State};
% Backend components
\node[block, below=2cm of ui] (api) {API};
\node[block, right=of api] (auth) {Auth};
\node[block, right=of auth] (logic) {Logic};
% Database
\node[block, below=2cm of api, fill=green!20] (db) {Database};
% Group boxes
\begin{scope}[on background layer]
\node[draw, dashed, rounded corners, fit=(ui)(state),
label=above:Frontend, fill=blue!5] {};
\node[draw, dashed, rounded corners, fit=(api)(auth)(logic),
label=above:Backend, fill=orange!5] {};
\end{scope}
% Connections
\draw[<->] (ui) -- (state);
\draw[arrow] (state) -- (api);
\draw[<->] (api) -- (auth);
\draw[<->] (auth) -- (logic);
\draw[arrow] (api) -- (db);
\draw[arrow] (logic) |- (db);
\end{tikzpicture}Data Flow Diagram
\tikzset{
entity/.style={
draw, rectangle,
minimum width=2cm, minimum height=1cm,
fill=blue!20
},
process/.style={
draw, circle,
minimum size=1.5cm,
fill=green!20
},
datastore/.style={
draw, rectangle,
minimum width=2.5cm, minimum height=0.8cm,
fill=yellow!20,
append after command={
(\tikzlastnode.north west) -- (\tikzlastnode.north east)
(\tikzlastnode.south west) -- (\tikzlastnode.south east)
}
}
}
\begin{tikzpicture}[node distance=2cm]
% Entities
\node[entity] (user) {User};
\node[entity, right=4cm of user] (admin) {Admin};
% Processes
\node[process, below=of user] (p1) {1.0};
\node[process, below=of admin] (p2) {2.0};
% Data store
\node[datastore, below right=2cm and 0.5cm of p1] (db) {D1 Database};
% Data flows
\draw[arrow] (user) -- node[left] {Request} (p1);
\draw[arrow] (p1) -- node[left] {Response} (user);
\draw[arrow] (p1) -- node[above] {Query} (db);
\draw[arrow] (db) -- node[below] {Data} (p1);
\draw[arrow] (admin) -- node[right] {Config} (p2);
\draw[arrow] (p2) -- node[above] {Update} (db);
\end{tikzpicture}Network Topology
\begin{tikzpicture}
\tikzset{
server/.style={
draw, rectangle,
minimum width=1.5cm, minimum height=1cm,
fill=blue!30
},
client/.style={
draw, rectangle,
minimum width=1cm, minimum height=0.8cm,
fill=green!30
},
router/.style={
draw, circle,
minimum size=1cm,
fill=orange!30
}
}
% Internet cloud
\node[draw, cloud, cloud puffs=10, cloud ignores aspect,
minimum width=3cm, minimum height=1.5cm, fill=gray!20]
(internet) at (4,3) {Internet};
% Router
\node[router] (router) at (4,0) {R};
% Servers
\node[server] (server1) at (0,0) {Server 1};
\node[server] (server2) at (8,0) {Server 2};
% Clients
\node[client] (c1) at (1,-2) {PC};
\node[client] (c2) at (3,-2) {PC};
\node[client] (c3) at (5,-2) {PC};
\node[client] (c4) at (7,-2) {PC};
% Connections
\draw[thick] (router) -- (internet);
\draw[thick] (server1) -- (router);
\draw[thick] (server2) -- (router);
\foreach \c in {c1,c2,c3,c4} {
\draw[thick] (\c) -- (router);
}
\end{tikzpicture}Next Steps
Continue learning TikZ diagrams:
- Trees - Hierarchical structures
- Graphs - Network and graph diagrams
- Circuit Diagrams - Electronic circuits
Block Diagrams in TikZ
Create system architecture diagrams, signal flow diagrams, and technical block diagrams.
Block Diagram Styles
\usetikzlibrary{shapes.geometric, arrows.meta, positioning, fit}
\tikzset{
block/.style={
draw, rectangle,
minimum width=2cm, minimum height=1cm,
text centered, fill=blue!10
},
sum/.style={
draw, circle,
minimum size=0.6cm,
inner sep=0pt
},
input/.style={coordinate},
output/.style={coordinate},
arrow/.style={-Stealth, thick},
line/.style={thick}
}Simple Block Diagram
\begin{tikzpicture}[node distance=2cm, auto]
% Blocks
\node[input] (input) {};
\node[block, right=of input] (system) {System};
\node[output, right=of system] (output) {};
% Connections
\draw[arrow] (input) -- node[above] {Input} (system);
\draw[arrow] (system) -- node[above] {Output} (output);
\end{tikzpicture}Feedback Control System
\begin{tikzpicture}[node distance=1.5cm, auto]
% Input
\node[input] (input) {};
% Sum junction
\node[sum, right=of input] (sum) {};
\node[above left=-2pt of sum] {$+$};
\node[below left=-2pt of sum] {$-$};
% Controller and Plant
\node[block, right=of sum] (controller) {Controller};
\node[block, right=of controller] (plant) {Plant};
% Output
\node[output, right=of plant] (output) {};
% Feedback
\node[block, below=of plant] (sensor) {Sensor};
% Connections
\draw[arrow] (input) -- node {$r$} (sum);
\draw[arrow] (sum) -- node {$e$} (controller);
\draw[arrow] (controller) -- node {$u$} (plant);
\draw[arrow] (plant) -- node[name=y] {$y$} (output);
\draw[arrow] (y) |- (sensor);
\draw[arrow] (sensor) -| (sum);
\end{tikzpicture}Signal Processing Chain
\begin{tikzpicture}[node distance=1.8cm]
% Signal processing blocks
\node[block] (adc) {ADC};
\node[block, right=of adc] (filter) {Filter};
\node[block, right=of filter] (fft) {FFT};
\node[block, right=of fft] (process) {Process};
\node[block, right=of process] (ifft) {IFFT};
\node[block, right=of ifft] (dac) {DAC};
% Input/output
\node[left=of adc] (in) {Analog In};
\node[right=of dac] (out) {Analog Out};
% Connect everything
\draw[arrow] (in) -- (adc);
\draw[arrow] (adc) -- node[above, font=\footnotesize] {Digital} (filter);
\draw[arrow] (filter) -- (fft);
\draw[arrow] (fft) -- node[above, font=\footnotesize] {Freq.} (process);
\draw[arrow] (process) -- (ifft);
\draw[arrow] (ifft) -- node[above, font=\footnotesize] {Time} (dac);
\draw[arrow] (dac) -- (out);
\end{tikzpicture}Parallel Processing Blocks
\begin{tikzpicture}[node distance=1.5cm]
% Input
\node[block] (input) {Input};
% Parallel blocks
\node[block, above right=1cm and 2cm of input] (proc1) {Process A};
\node[block, right=2cm of input] (proc2) {Process B};
\node[block, below right=1cm and 2cm of input] (proc3) {Process C};
% Merge
\node[block, right=2cm of proc2] (merge) {Merge};
% Output
\node[block, right=of merge] (output) {Output};
% Connections - split
\draw[arrow] (input.east) -- ++(0.5,0) |- (proc1.west);
\draw[arrow] (input.east) -- (proc2.west);
\draw[arrow] (input.east) -- ++(0.5,0) |- (proc3.west);
% Connections - merge
\draw[arrow] (proc1.east) -| ([xshift=-0.5cm]merge.west) -- (merge.west);
\draw[arrow] (proc2.east) -- (merge.west);
\draw[arrow] (proc3.east) -| ([xshift=-0.5cm]merge.west);
\draw[arrow] (merge) -- (output);
\end{tikzpicture}Layered Architecture
\begin{tikzpicture}
\tikzset{
layer/.style={
draw, rectangle,
minimum width=8cm, minimum height=1.2cm,
text centered
}
}
% Layers from bottom to top
\node[layer, fill=gray!30] (hw) at (0,0) {Hardware Layer};
\node[layer, fill=blue!20] (os) at (0,1.5) {Operating System};
\node[layer, fill=green!20] (rt) at (0,3) {Runtime Environment};
\node[layer, fill=yellow!20] (app) at (0,4.5) {Application Layer};
\node[layer, fill=red!20] (ui) at (0,6) {User Interface};
% Arrows between layers
\draw[<->, thick] ([xshift=-3cm]hw.north) -- ([xshift=-3cm]os.south);
\draw[<->, thick] ([xshift=-3cm]os.north) -- ([xshift=-3cm]rt.south);
\draw[<->, thick] ([xshift=-3cm]rt.north) -- ([xshift=-3cm]app.south);
\draw[<->, thick] ([xshift=-3cm]app.north) -- ([xshift=-3cm]ui.south);
\end{tikzpicture}Component Diagram with Groups
\usetikzlibrary{backgrounds, fit}
\begin{tikzpicture}[node distance=1.5cm]
% Frontend components
\node[block] (ui) {UI};
\node[block, right=of ui] (state) {State};
% Backend components
\node[block, below=2cm of ui] (api) {API};
\node[block, right=of api] (auth) {Auth};
\node[block, right=of auth] (logic) {Logic};
% Database
\node[block, below=2cm of api, fill=green!20] (db) {Database};
% Group boxes
\begin{scope}[on background layer]
\node[draw, dashed, rounded corners, fit=(ui)(state),
label=above:Frontend, fill=blue!5] {};
\node[draw, dashed, rounded corners, fit=(api)(auth)(logic),
label=above:Backend, fill=orange!5] {};
\end{scope}
% Connections
\draw[<->] (ui) -- (state);
\draw[arrow] (state) -- (api);
\draw[<->] (api) -- (auth);
\draw[<->] (auth) -- (logic);
\draw[arrow] (api) -- (db);
\draw[arrow] (logic) |- (db);
\end{tikzpicture}Data Flow Diagram
\tikzset{
entity/.style={
draw, rectangle,
minimum width=2cm, minimum height=1cm,
fill=blue!20
},
process/.style={
draw, circle,
minimum size=1.5cm,
fill=green!20
},
datastore/.style={
draw, rectangle,
minimum width=2.5cm, minimum height=0.8cm,
fill=yellow!20,
append after command={
(\tikzlastnode.north west) -- (\tikzlastnode.north east)
(\tikzlastnode.south west) -- (\tikzlastnode.south east)
}
}
}
\begin{tikzpicture}[node distance=2cm]
% Entities
\node[entity] (user) {User};
\node[entity, right=4cm of user] (admin) {Admin};
% Processes
\node[process, below=of user] (p1) {1.0};
\node[process, below=of admin] (p2) {2.0};
% Data store
\node[datastore, below right=2cm and 0.5cm of p1] (db) {D1 Database};
% Data flows
\draw[arrow] (user) -- node[left] {Request} (p1);
\draw[arrow] (p1) -- node[left] {Response} (user);
\draw[arrow] (p1) -- node[above] {Query} (db);
\draw[arrow] (db) -- node[below] {Data} (p1);
\draw[arrow] (admin) -- node[right] {Config} (p2);
\draw[arrow] (p2) -- node[above] {Update} (db);
\end{tikzpicture}Network Topology
\begin{tikzpicture}
\tikzset{
server/.style={
draw, rectangle,
minimum width=1.5cm, minimum height=1cm,
fill=blue!30
},
client/.style={
draw, rectangle,
minimum width=1cm, minimum height=0.8cm,
fill=green!30
},
router/.style={
draw, circle,
minimum size=1cm,
fill=orange!30
}
}
% Internet cloud
\node[draw, cloud, cloud puffs=10, cloud ignores aspect,
minimum width=3cm, minimum height=1.5cm, fill=gray!20]
(internet) at (4,3) {Internet};
% Router
\node[router] (router) at (4,0) {R};
% Servers
\node[server] (server1) at (0,0) {Server 1};
\node[server] (server2) at (8,0) {Server 2};
% Clients
\node[client] (c1) at (1,-2) {PC};
\node[client] (c2) at (3,-2) {PC};
\node[client] (c3) at (5,-2) {PC};
\node[client] (c4) at (7,-2) {PC};
% Connections
\draw[thick] (router) -- (internet);
\draw[thick] (server1) -- (router);
\draw[thick] (server2) -- (router);
\foreach \c in {c1,c2,c3,c4} {
\draw[thick] (\c) -- (router);
}
\end{tikzpicture}Next Steps
Continue learning TikZ diagrams:
- Trees - Hierarchical structures
- Graphs - Network and graph diagrams
- Circuit Diagrams - Electronic circuits