TikZ Generator
Pick a diagram type, fill in the labels and connections, and this TikZ generator writes the tikzpicture code with a live preview. Copy the picture alone or a complete document that compiles in Overleaf or any LaTeX install.
Preview
LaTeX
\begin{tikzpicture}[>=Stealth, every node/.style={font=\small}]
\node[draw, fill=red!15, rounded corners, minimum width=2.6cm, minimum height=0.8cm, align=center] (ns1) at (0,0) {Start};
\node[draw, fill=green!15, minimum width=3cm, minimum height=0.8cm, align=center] (ns2) at (0,-1.7) {Read input x};
\node[draw, fill=yellow!20, diamond, aspect=2, minimum width=3.24cm, minimum height=1.4cm, align=center] (ns3) at (0,-3.7) {Is x \textgreater{} 0?};
\node[draw, fill=blue!10, minimum width=2.6cm, minimum height=0.8cm, align=center] (ns4) at (0,-5.7) {Print x};
\node[draw, fill=red!15, rounded corners, minimum width=2.6cm, minimum height=0.8cm, align=center] (ns5) at (0,-7.4) {End};
\draw[->] (ns1) -- (ns2);
\draw[->] (ns2) -- (ns3);
\draw[->] (ns3) -- node[midway, fill=white, inner sep=1pt] {Yes} (ns4);
\draw[->] (ns3.east) -- node[above] {No} ++(1.1,0) |- (ns2.east);
\draw[->] (ns4) -- (ns5);
\end{tikzpicture}Add to your preamble: \usepackage{tikz} \usetikzlibrary{arrows.meta,shapes.geometric}
Have the diagram as a sketch or an image? Convert it to LaTeX instead of rebuilding it.
Convert an imageHow to use the TikZ generator
Pick a diagram type
The TikZ generator offers a flowchart, a tree, a graph or automaton, a function plot, a neural network or a commutative diagram. Each type has its own small form, and a sensible example is filled in so you can see the result before typing anything.
Fill in labels and connections
Type step names, an indented outline, one edge per line, formulas or layer sizes. The preview redraws as you type, from the same coordinates the TikZ generator writes into the code, so what you see is where each node lands.
Copy the picture or a whole document
Copy just the tikzpicture from the TikZ generator into your paper, with the \usepackage and \usetikzlibrary lines listed under it, or switch to a complete standalone document that compiles on its own into a tightly cropped PDF.
TikZ diagrams it draws
Flowcharts
Steps stack top to bottom as rounded start and end boxes, process rectangles, input and output boxes and decision diamonds. A decision can send its "no" branch back up or forward to any step; the TikZ generator routes it around the right side with |- so it never crosses the main column.
Trees, graphs and automata
In the TikZ generator, a tree comes from an indented outline and is laid out with parents centered over their children. For a graph, write A -> B: label or A -- B on each line; set a start state and accepting states and the same graph becomes a finite automaton with double circles and a start arrow.
Plots, neural networks and tikz-cd
The TikZ generator draws function plots with pgfplots, up to five formulas, radians for trigonometry and an optional grid. A neural network takes layer sizes such as 3, 4, 2 and connects every neuron to the next layer. The commutative square uses tikz-cd, with any labels in math mode.
Working with the generated code
Every node has a position
The TikZ generator places nodes at explicit coordinates in centimetres, like at (0,-1.7). To move one, change its numbers; to make the whole picture smaller, add scale=0.8, transform shape to the tikzpicture options. Edges refer to nodes by name, so they follow automatically.
Labels, symbols and math
The TikZ generator escapes plain text, so &, %, < and > print as typed. Put math between dollar signs, such as $q_0$ or $x \leq 1$, and it is kept as LaTeX. The equation editor helps build longer math labels.
LaTeX equation editorCompiling and exporting
The code compiles with pdfLaTeX, XeLaTeX or LuaLaTeX, including on Overleaf. A standalone document gives a PDF the size of the diagram, which you can include with \includegraphics or convert to PNG or SVG. Every template from this TikZ generator was checked by compiling it.
Official references: PGF/TikZ (CTAN)

TikZ questions
- What is TikZ LaTeX?
- TikZ is a LaTeX package for drawing diagrams with code, built on the PGF graphics layer. Its pictures use your document's fonts and stay sharp at any size, which is why papers and theses prefer it to pasted images.
- How to center a TikZ picture?
- Put \centering before the tikzpicture inside a figure environment, or wrap it in a center environment. A standalone document is cropped to the picture, so it needs no centering.
- How to use TikZ in LaTeX?
- Add \usepackage{tikz} to the preamble, load any libraries with \usetikzlibrary, and draw inside \begin{tikzpicture} … \end{tikzpicture}. The TikZ generator writes all three parts.
- How to install TikZ package in LaTeX?
- TikZ ships with TeX Live, MacTeX and MiKTeX, so it is usually installed already. MiKTeX can fetch missing packages on first use; Overleaf has everything. Libraries come with the package.
- How to scale a TikZ picture?
- Add [scale=0.8, transform shape] to the tikzpicture to shrink lines and text together, or wrap the picture in \resizebox{\linewidth}{!}{…} to fit the text width.
- How to convert a TikZ to EPS?
- Compile the picture as a standalone document to PDF, then convert it with pdftops -eps file.pdf. Most journals now accept the PDF itself.
- Does Overleaf support TikZ?
- Yes. Overleaf includes TikZ, pgfplots and tikz-cd. Paste the code from the TikZ generator into your document and add the preamble lines.
- Why does TikZ fail?
- Usually a missing semicolon at the end of a path, a library that was not loaded, or an unescaped & or % in a label. Code from the TikZ generator ends every path with a semicolon and lists the libraries it uses.
- How to label a node TikZ?
- The label is the text in braces: \node (a) at (0,0) {Label};. For a second label beside it, add label=above:{Note} to the node options.
- How to draw arrows in TikZ?
- Use \draw[->] (a) -- (b);. The TikZ generator sets >=Stealth from the arrows.meta library for a cleaner arrowhead.
- How to do dash lines in TikZ?
- Add dashed or dotted to the draw options, as in \draw[dashed, ->] (a) -- (b);.
- How to use color in TikZ?
- Use draw=red for lines, fill=blue!10 for a light fill and text=green!50!black for text. The x!n form mixes a color with n percent of it and the rest white.
- How to make a graph in TikZ?
- Place nodes, then connect them with \draw (a) -- (b);. In the TikZ generator, choose Graph and write one edge per line, such as A -> B: 5.
- How to draw a circle TikZ?
- Use \draw (0,0) circle (1cm); for a plain circle, or \node[draw, circle] {A}; for a circle around text.
- Can the TikZ generator make flowcharts?
- Yes. Choose Flowchart, add steps with their shapes and give a decision a "no" target. The generator places the steps and routes the branches for you.
- Can I draw a commutative diagram with tikz-cd here?
- Yes, the TikZ generator draws a commutative square with an optional diagonal. Objects and arrow labels are math, so \varphi or f' work as typed.
- Can it plot functions with pgfplots?
- Yes, the TikZ generator plots up to five functions of x with your own range, axis labels and grid. Formulas such as 2x^2 - 3 or sin(x)/x are checked as you type.
- Is this an AI TikZ generator?
- No. This TikZ generator builds the code from templates, so the result is exact, instant and free. A describe-it-in-words mode may come later.
- Can I generate TikZ code from an image?
- Not on this page. Our converter reads images and returns LaTeX, which works best for equations and tables.
- Can I preview TikZ code online without installing LaTeX?
- For diagrams made in the TikZ generator, yes: the preview is drawn in your browser from the same coordinates as the code. Arbitrary TikZ needs a real compiler, such as Overleaf.
Have a whole page of notes, a scan or a PDF? Convert it to LaTeX that compiles.
Convert a file