Circuit Diagrams in TikZ
Draw professional electronic circuit diagrams using CircuiTikZ.
Circuit diagrams use the CircuiTikZ package, which is built on TikZ. Load it with
\usepackage{circuitikz}Basic Setup
\usepackage{circuitikz}
% Optional: set default style
\ctikzset{
resistors/scale=0.8,
capacitors/scale=0.8
}Basic Components
\begin{circuitikz}
% Resistor
\draw (0,0) to[R, l=$R_1$] (2,0);
% Capacitor
\draw (0,-1) to[C, l=$C_1$] (2,-1);
% Inductor
\draw (0,-2) to[L, l=$L_1$] (2,-2);
% Voltage source
\draw (0,-3) to[V, l=$V_s$] (2,-3);
% Current source
\draw (0,-4) to[I, l=$I_s$] (2,-4);
% Ground
\draw (3,0) node[ground] {};
\end{circuitikz}Simple RC Circuit
\begin{circuitikz}
\draw (0,0)
to[V, l=$V_s$] (0,2) % Voltage source
to[R, l=$R$] (2,2) % Resistor
to[C, l=$C$] (2,0) % Capacitor
-- (0,0); % Complete the circuit
% Add ground
\draw (0,0) node[ground] {};
\end{circuitikz}Voltage Divider
\begin{circuitikz}
\draw (0,0)
to[V, l=$V_{in}$] (0,3) % Input voltage
to[short] (2,3)
to[R, l=$R_1$] (2,1.5) % R1
to[R, l=$R_2$] (2,0) % R2
to[short] (0,0);
% Output voltage node
\draw (2,1.5) to[short, -o] (3,1.5) node[right] {$V_{out}$};
% Ground
\draw (1,0) node[ground] {};
\end{circuitikz}Op-Amp Circuits
\begin{circuitikz}
% Op-amp symbol
\draw (3,2) node[op amp] (opamp) {};
% Input resistor
\draw (0,2.5) node[left] {$V_{in}$}
to[R, l=$R_1$] (opamp.-);
% Feedback resistor
\draw (opamp.-) -- ++(0,1.5) coordinate (fb)
to[R, l=$R_f$] (fb -| opamp.out)
-- (opamp.out);
% Non-inverting input to ground
\draw (opamp.+) -- ++(0,-0.5) node[ground] {};
% Output
\draw (opamp.out) to[short, -o] ++(0.5,0) node[right] {$V_{out}$};
\end{circuitikz}Transistor Circuits
\begin{circuitikz}
% NPN common emitter amplifier
\draw (2,2) node[npn] (npn) {};
% Base circuit
\draw (0,2) node[left] {$V_{in}$}
to[C, l=$C_1$] (npn.base);
% Bias resistors
\draw (npn.base) -- ++(0,1) to[R, l=$R_1$] ++(0,1.5)
-- ++(1,0) node[vcc] {$V_{CC}$};
\draw (npn.base) -- ++(0,-1) to[R, l=$R_2$] ++(0,-1.5)
node[ground] {};
% Collector resistor
\draw (npn.collector) to[R, l=$R_C$] ++(0,2)
node[vcc] {$V_{CC}$};
% Emitter resistor
\draw (npn.emitter) to[R, l=$R_E$] ++(0,-1.5)
node[ground] {};
% Output
\draw (npn.collector) to[C, l=$C_2$, -o] ++(2,0)
node[right] {$V_{out}$};
\end{circuitikz}Logic Gates
\begin{circuitikz}
% AND gate
\draw (0,0) node[and port] (and) {};
\draw (and.in 1) -- ++(-0.5,0) node[left] {A};
\draw (and.in 2) -- ++(-0.5,0) node[left] {B};
\draw (and.out) -- ++(0.5,0) node[right] {A AND B};
% OR gate
\draw (0,-2) node[or port] (or) {};
\draw (or.in 1) -- ++(-0.5,0) node[left] {A};
\draw (or.in 2) -- ++(-0.5,0) node[left] {B};
\draw (or.out) -- ++(0.5,0) node[right] {A OR B};
% NOT gate
\draw (0,-4) node[not port] (not) {};
\draw (not.in) -- ++(-0.5,0) node[left] {A};
\draw (not.out) -- ++(0.5,0) node[right] {NOT A};
% NAND gate
\draw (4,0) node[nand port] (nand) {};
% NOR gate
\draw (4,-2) node[nor port] (nor) {};
% XOR gate
\draw (4,-4) node[xor port] (xor) {};
\end{circuitikz}Diode Circuits
\begin{circuitikz}
% Half-wave rectifier
\draw (0,0)
to[sV, l=$V_{AC}$] (0,2)
to[D, l=$D_1$] (2,2)
to[R, l=$R_L$] (2,0)
-- (0,0);
% Full-wave bridge rectifier
\draw (5,0)
to[sV, l=$V_{AC}$] (5,2)
to[short] (6,2)
to[D] (7,1)
to[D] (6,0)
-- (5,0);
\draw (6,2) to[D] (7,3) to[short] (8,3)
to[R, l=$R_L$] (8,1)
to[short] (7,1);
\draw (7,3) to[D] (6,2);
\draw (6,0) to[D] (7,-1) -- (8,-1) -- (8,1);
\end{circuitikz}Component Labels and Values
\begin{circuitikz}
% Label on left
\draw (0,0) to[R, l=$R_1$] (2,0);
% Label on right (underscore after l)
\draw (0,-1) to[R, l_=$10k\Omega$] (2,-1);
% Value annotation
\draw (0,-2) to[R, l=$R_2$, a=$4.7k$] (2,-2);
% Voltage annotation
\draw (0,-3) to[R, l=$R_3$, v=$V_R$] (2,-3);
% Current annotation
\draw (0,-4) to[R, l=$R_4$, i=$I$] (2,-4);
% Bipole with everything
\draw (0,-5) to[R, l=$R_5$, v=$V$, i=$I$] (2,-5);
\end{circuitikz}555 Timer Circuit
\begin{circuitikz}
% 555 Timer IC (represented as a box)
\draw (3,2) node[dipchip, num pins=8, external pins width=0.0,
hide numbers] (chip) {555};
% Power connections
\draw (chip.pin 8) -- ++(0,0.5) node[vcc] {$V_{CC}$};
\draw (chip.pin 1) -- ++(0,-0.5) node[ground] {};
% Timing components
\draw (chip.pin 7) -- ++(-1,0) to[R, l=$R_1$] ++(-1.5,0)
-- ++(0,1) node[vcc] {$V_{CC}$};
\draw (chip.pin 6) -- ++(-1,0) to[R, l=$R_2$] ++(0,1.5)
-- (chip.pin 7 -| 0,0);
\draw (chip.pin 2) -- ++(-1,0) to[C, l=$C$] ++(0,-1.5)
node[ground] {};
% Output
\draw (chip.pin 3) to[short, -o] ++(1,0) node[right] {Out};
\end{circuitikz}Common Component Symbols
R- ResistorC- CapacitorL- InductorD- DiodeV- Voltage sourceI- Current sourcenpn,pnp- Transistorsop amp- Operational amplifierand port,or port- Logic gates
Next Steps
Continue learning TikZ:
- Block Diagrams - System-level diagrams
- PGFPlots - Plot data and graphs
- Flowcharts - Process diagrams
Circuit Diagrams in TikZ
Draw professional electronic circuit diagrams using CircuiTikZ.
Circuit diagrams use the CircuiTikZ package, which is built on TikZ. Load it with
\usepackage{circuitikz}Basic Setup
\usepackage{circuitikz}
% Optional: set default style
\ctikzset{
resistors/scale=0.8,
capacitors/scale=0.8
}Basic Components
\begin{circuitikz}
% Resistor
\draw (0,0) to[R, l=$R_1$] (2,0);
% Capacitor
\draw (0,-1) to[C, l=$C_1$] (2,-1);
% Inductor
\draw (0,-2) to[L, l=$L_1$] (2,-2);
% Voltage source
\draw (0,-3) to[V, l=$V_s$] (2,-3);
% Current source
\draw (0,-4) to[I, l=$I_s$] (2,-4);
% Ground
\draw (3,0) node[ground] {};
\end{circuitikz}Simple RC Circuit
\begin{circuitikz}
\draw (0,0)
to[V, l=$V_s$] (0,2) % Voltage source
to[R, l=$R$] (2,2) % Resistor
to[C, l=$C$] (2,0) % Capacitor
-- (0,0); % Complete the circuit
% Add ground
\draw (0,0) node[ground] {};
\end{circuitikz}Voltage Divider
\begin{circuitikz}
\draw (0,0)
to[V, l=$V_{in}$] (0,3) % Input voltage
to[short] (2,3)
to[R, l=$R_1$] (2,1.5) % R1
to[R, l=$R_2$] (2,0) % R2
to[short] (0,0);
% Output voltage node
\draw (2,1.5) to[short, -o] (3,1.5) node[right] {$V_{out}$};
% Ground
\draw (1,0) node[ground] {};
\end{circuitikz}Op-Amp Circuits
\begin{circuitikz}
% Op-amp symbol
\draw (3,2) node[op amp] (opamp) {};
% Input resistor
\draw (0,2.5) node[left] {$V_{in}$}
to[R, l=$R_1$] (opamp.-);
% Feedback resistor
\draw (opamp.-) -- ++(0,1.5) coordinate (fb)
to[R, l=$R_f$] (fb -| opamp.out)
-- (opamp.out);
% Non-inverting input to ground
\draw (opamp.+) -- ++(0,-0.5) node[ground] {};
% Output
\draw (opamp.out) to[short, -o] ++(0.5,0) node[right] {$V_{out}$};
\end{circuitikz}Transistor Circuits
\begin{circuitikz}
% NPN common emitter amplifier
\draw (2,2) node[npn] (npn) {};
% Base circuit
\draw (0,2) node[left] {$V_{in}$}
to[C, l=$C_1$] (npn.base);
% Bias resistors
\draw (npn.base) -- ++(0,1) to[R, l=$R_1$] ++(0,1.5)
-- ++(1,0) node[vcc] {$V_{CC}$};
\draw (npn.base) -- ++(0,-1) to[R, l=$R_2$] ++(0,-1.5)
node[ground] {};
% Collector resistor
\draw (npn.collector) to[R, l=$R_C$] ++(0,2)
node[vcc] {$V_{CC}$};
% Emitter resistor
\draw (npn.emitter) to[R, l=$R_E$] ++(0,-1.5)
node[ground] {};
% Output
\draw (npn.collector) to[C, l=$C_2$, -o] ++(2,0)
node[right] {$V_{out}$};
\end{circuitikz}Logic Gates
\begin{circuitikz}
% AND gate
\draw (0,0) node[and port] (and) {};
\draw (and.in 1) -- ++(-0.5,0) node[left] {A};
\draw (and.in 2) -- ++(-0.5,0) node[left] {B};
\draw (and.out) -- ++(0.5,0) node[right] {A AND B};
% OR gate
\draw (0,-2) node[or port] (or) {};
\draw (or.in 1) -- ++(-0.5,0) node[left] {A};
\draw (or.in 2) -- ++(-0.5,0) node[left] {B};
\draw (or.out) -- ++(0.5,0) node[right] {A OR B};
% NOT gate
\draw (0,-4) node[not port] (not) {};
\draw (not.in) -- ++(-0.5,0) node[left] {A};
\draw (not.out) -- ++(0.5,0) node[right] {NOT A};
% NAND gate
\draw (4,0) node[nand port] (nand) {};
% NOR gate
\draw (4,-2) node[nor port] (nor) {};
% XOR gate
\draw (4,-4) node[xor port] (xor) {};
\end{circuitikz}Diode Circuits
\begin{circuitikz}
% Half-wave rectifier
\draw (0,0)
to[sV, l=$V_{AC}$] (0,2)
to[D, l=$D_1$] (2,2)
to[R, l=$R_L$] (2,0)
-- (0,0);
% Full-wave bridge rectifier
\draw (5,0)
to[sV, l=$V_{AC}$] (5,2)
to[short] (6,2)
to[D] (7,1)
to[D] (6,0)
-- (5,0);
\draw (6,2) to[D] (7,3) to[short] (8,3)
to[R, l=$R_L$] (8,1)
to[short] (7,1);
\draw (7,3) to[D] (6,2);
\draw (6,0) to[D] (7,-1) -- (8,-1) -- (8,1);
\end{circuitikz}Component Labels and Values
\begin{circuitikz}
% Label on left
\draw (0,0) to[R, l=$R_1$] (2,0);
% Label on right (underscore after l)
\draw (0,-1) to[R, l_=$10k\Omega$] (2,-1);
% Value annotation
\draw (0,-2) to[R, l=$R_2$, a=$4.7k$] (2,-2);
% Voltage annotation
\draw (0,-3) to[R, l=$R_3$, v=$V_R$] (2,-3);
% Current annotation
\draw (0,-4) to[R, l=$R_4$, i=$I$] (2,-4);
% Bipole with everything
\draw (0,-5) to[R, l=$R_5$, v=$V$, i=$I$] (2,-5);
\end{circuitikz}555 Timer Circuit
\begin{circuitikz}
% 555 Timer IC (represented as a box)
\draw (3,2) node[dipchip, num pins=8, external pins width=0.0,
hide numbers] (chip) {555};
% Power connections
\draw (chip.pin 8) -- ++(0,0.5) node[vcc] {$V_{CC}$};
\draw (chip.pin 1) -- ++(0,-0.5) node[ground] {};
% Timing components
\draw (chip.pin 7) -- ++(-1,0) to[R, l=$R_1$] ++(-1.5,0)
-- ++(0,1) node[vcc] {$V_{CC}$};
\draw (chip.pin 6) -- ++(-1,0) to[R, l=$R_2$] ++(0,1.5)
-- (chip.pin 7 -| 0,0);
\draw (chip.pin 2) -- ++(-1,0) to[C, l=$C$] ++(0,-1.5)
node[ground] {};
% Output
\draw (chip.pin 3) to[short, -o] ++(1,0) node[right] {Out};
\end{circuitikz}Common Component Symbols
R- ResistorC- CapacitorL- InductorD- DiodeV- Voltage sourceI- Current sourcenpn,pnp- Transistorsop amp- Operational amplifierand port,or port- Logic gates
Next Steps
Continue learning TikZ:
- Block Diagrams - System-level diagrams
- PGFPlots - Plot data and graphs
- Flowcharts - Process diagrams