Online TikZ editor with live preview
Write or paste TikZ code (a tikzpicture, bare drawing commands or a whole LaTeX document) and the editor typesets it with TeX Live each time you pause typing, so the preview follows your code. Errors point to the line that caused them. Download the figure as a transparent PNG at 300 or 600 dpi with its DPI recorded, copy it, or open it in the LabCanvas editor as editable vector shapes (they stay editable inside LabCanvas; the download is the PNG). pgfplots, circuitikz, tikz-cd, chemfig and the common TikZ libraries are preloaded, pdfLaTeX, LuaLaTeX and XeLaTeX are available, and a library of figures from open-source collections gives you code to start from.
- What it does
- Typesets TikZ with TeX Live (pdfLaTeX, LuaLaTeX or XeLaTeX) as you type and shows the figure, ready to download as a transparent PNG or to open in the LabCanvas editor as editable shapes.
- Formula
- Example
- The flowchart example is 288.6 × 81.6 pt (10.2 × 2.9 cm). At 600 dpi the PNG is 288.645 ÷ 72 × 600 = 2405 by 81.55 ÷ 72 × 600 = 680 pixels.
Last updated · First published
Loading TikZ editor…
At a glance
| Input | TikZ code up to 100 KB: a tikzpicture, bare commands, circuitikz, tikzcd, \chemfig or a full LaTeX document |
|---|---|
| Engines | pdfLaTeX, LuaLaTeX, XeLaTeX (TeX Live, no shell escape) |
| Preloaded | TikZ and common libraries, pgfplots, circuitikz, tikz-cd, chemfig, siunitx, amsmath, amssymb, xcolor |
| Output | Transparent PNG at 300 or 600 dpi (DPI recorded), or editable shapes in the LabCanvas editor |
| Limits | 25 s of LaTeX time per render; the first page of a multi-page document |
| Free renders | Without an account: 30 new renders a day, 10 a minute. Signed in (free): 30 a minute, no daily limit. Cached results do not count |
| Runs on | LabCanvas servers: TeX Live in an isolated container, without network access; your code is sent there to be typeset |
| Price | Free; a free account removes the daily limit |
What it does
How to use the tikZ editor
- Paste your TikZ or pick an exampleType or paste the code. A tikzpicture, bare drawing commands and full documents all work; the common packages are already loaded.
- Choose the enginepdfLaTeX suits most figures. Choose LuaLaTeX or XeLaTeX for fontspec, other fonts and Unicode input. Extra packages or TikZ libraries go in the preamble under More options.
- Fix any error, then downloadIf LaTeX stops, the message points to the line; click it to jump there. Then download a PNG at 300 or 600 dpi, copy the image, or open it in the LabCanvas editor as editable shapes.
How it works
Typesetting. The code is sent to the LabCanvas TikZ renderer, which runs TeX Live (scheme-full) in an isolated container. Code that contains \documentclass is compiled as it is. Other code goes into \documentclass[tikz,border=2pt]{standalone} with a default preamble: TikZ with the common libraries (arrows.meta, positioning, calc, shapes, decorations, patterns, shadings, matrix, trees, mindmap, intersections, backgrounds, fit, 3d and more), pgfplots with compat=1.18, circuitikz, tikz-cd, chemfig, siunitx, amsmath, amssymb and xcolor with the dvips and SVG colour names, followed by your own preamble. Bare drawing commands are also wrapped in a tikzpicture. The engine runs without shell escape (no \write18), with a 25-second limit.
Output. poppler’s pdftocairo turns the first page of the PDF that LaTeX makes into vector outlines, with the text as outlines too (so it looks the same everywhere and needs no fonts). The preview and the PNG downloads are drawn from these outlines in your browser at the resolution you choose; the figure keeps its LaTeX size, where 1 pt is 1/72 inch, so the PNG is size in pt ÷ 72 × dpi pixels and records its DPI. A document with several pages shows its first page. The outlines themselves are not a download: they go to the LabCanvas editor as editable shapes.
Free renders. Each new render runs TeX Live on a LabCanvas server, so there is a fair-use allowance: without an account, 30 new renders a day and 10 a minute from one address; signed in with a free LabCanvas account, 30 a minute and no daily limit. A render that comes back from the cache (code, engine and preamble already typeset) does not count.
Errors. LaTeX is run with -halt-on-error -file-line-error. The tool reads the log, takes the first error, maps its line back to your code (the preamble lines the tool adds are not counted) and shows the message, the line and the end of the log.
Worked example: a flowchart, from code to a 600 dpi PNG
- Write the nodes. The flowchart example defines a style
box/.style={draw, rounded corners, fill=teal!12, minimum width=24mm, minimum height=8mm, align=center}and places four boxes withright=ofandbelow=offrom the positioning library, 8 mm apart vertically and 14 mm horizontally (node distance=8mm and 14mm).\\inside a node breaks the line, whichalign=centerallows. - Draw the arrows.
\draw[->, thick] (sample) -- (extract);joins two boxes;|-goes vertically then horizontally, and-|the other way.>=Stealth(arrows.meta) sets the arrow tip for the whole picture. - Read the size. The renderer reports the figure as 288.6 × 81.6 pt, which is 288.645 ÷ 72 × 2.54 = 10.2 cm by 2.9 cm: wider than a single journal column (often about 8–9 cm), so for a one-column figure reduce
minimum widthor the node distance. - Export. At 600 dpi the PNG is 288.645 ÷ 72 × 600 = 2405 by 81.55 ÷ 72 × 600 = 680 pixels, and placed in Word or PowerPoint it is 10.2 cm wide because the DPI is written into the file. For a figure with other panels, choose Edit in LabCanvas instead: the boxes, arrows and outlined text arrive as editable shapes.
| Message | Usual cause |
|---|---|
| Undefined control sequence | A misspelt command, or one from a package or library that is not loaded |
| I do not know the key '/tikz/…' | A misspelt option, or an option from a TikZ library: add \usetikzlibrary{…} to the preamble |
| Giving up on this path. Did you forget a semicolon? | A \draw or \path without its closing ; |
| Missing $ inserted | Maths (subscripts, Greek letters) outside $…$, often inside a node |
| Dimension too large | A coordinate or a number in a computation beyond TeX’s limit of about 16 000 |
| Stopped after 25 s | A loop that never ends, or a very large \foreach or plot |
Frequently asked questions
How do I turn TikZ code into an image online?
Paste the code into the editor and pause: the figure is typeset with TeX Live and shown next to the code, and it updates each time you stop typing. Download it as a transparent PNG at 300 or 600 dpi, or open it in the LabCanvas editor, where it arrives as editable vector shapes to finish with the rest of your figure.
Can I download the figure as SVG or PDF?
No. Like the rest of LabCanvas, the TikZ editor downloads pictures only: a transparent PNG at 300 or 600 dpi with its DPI recorded, so it is placed at its real size in Word, PowerPoint or a journal submission. To keep editing the shapes, open the figure in the LabCanvas editor; it stays editable there.
Which packages and TikZ libraries are supported?
The renderer runs TeX Live with its full package collection, so any package in TeX Live can be loaded in the preamble (More options) or in a full document. TikZ with the common libraries, pgfplots, circuitikz, tikz-cd, chemfig, siunitx, amsmath and amssymb are loaded for you. Not available: shell escape (so minted, gnuplot plots through shell escape and TikZ externalisation do not work), network access, and your own files (\input of your files or \includegraphics of your images).
How big can the code and the figure be?
Up to 100 KB of code and 25 seconds of LaTeX time per render. Only the first page of a multi-page document is shown. Very large pictures (tens of thousands of objects) can run out of TeX’s memory or time; split them or simplify the plot (fewer samples).
Is my code kept?
Your code is sent to the LabCanvas renderer to be typeset, and your inputs stay saved in this browser. The renderer keeps a cache of results keyed by a hash of the code, engine and preamble, so the same input is answered without typesetting it again. A cached result is the rendered picture or, for code that stops with an error, the error message and the end of the LaTeX log, which can quote lines of your code. The cache is not public or searchable, and the code is not linked to your account. To count the free renders of visitors without an account, the renderer keeps one number per address (a hash of it) for the current day, cleared when the day ends (UTC).
Can I use pdfLaTeX, LuaLaTeX or XeLaTeX?
Yes, choose the engine in step 2. pdfLaTeX is the fastest and suits most TikZ. LuaLaTeX and XeLaTeX load fonts with fontspec (TeX Live’s fonts, such as TeX Gyre and Libertinus) and accept Unicode text directly.
Why does my figure look different from my document?
The tool uses the standalone class with Computer Modern / Latin Modern fonts at 10 pt. If your document uses another font or font size, add the same packages to the preamble (for example \usepackage{newtxtext,newtxmath}), or paste the whole document with its \documentclass.
Can I edit the figure after rendering?
Open it in the LabCanvas editor: lines, fills and outlined text arrive as separate vector shapes you can recolour and move, next to your plots, structures and images. Double-click it there to reopen the TikZ and render it again.
Where do the library figures come from, and can I use them?
From open-source TikZ collections on GitHub whose licences allow any use, commercial use included: MIT (janosh/diagrams, PetarV-/TikZ, MartinThoma/LaTeX-examples, the code of Stefan Kottwitz’s LaTeX Graphics with TikZ, xinychen/awesome-latex-drawing, fraserlove/nntikz and others) and CC0 (OpenTikZ). Each figure’s code starts with its source file, author and licence, and the Sources and licences page lists every collection with its full licence text. Keep that header in the code you reuse; the MIT licence asks for its copyright and permission notice to go with copies of the code. Figures that were adapted from other people’s work, carried no licence, or came under a share-alike licence were left out.
Is it free?
Yes. Without an account you get 30 new renders a day (up to 10 a minute); sign in with a free LabCanvas account and there is no daily limit (up to 30 new renders a minute). Results that come back from the cache do not count. When the day’s free renders are used, the tool offers to sign you in and brings you back with your code where you left it.
Link to this tool
Using it in a protocol, lab wiki or course page? Copy a link or citation.
<a href="https://www.labcanvas.com/tools/tikz-editor">TikZ editor</a> (LabCanvas)LabCanvas. TikZ editor [online tool]. https://www.labcanvas.com/tools/tikz-editorPut the TikZ figure in a larger figure
Open it in the LabCanvas editor as editable vector shapes, next to your plots, microscopy images and structures, and export it at the size and dpi your journal asks for.
Open the figure editor