TikZ Draw

A browser-based visual editor for creating TikZ diagrams. Draw geometric shapes, add LaTeX labels, and export clean TikZ code for use in LaTeX documents.

TikZ Draw Screenshot

Features

Getting Started

Simply open tikz-draw.html in a modern web browser. No installation or server required. Try the demo.

# Clone the repository
git clone https://github.com/keplerg/tikz-draw.git

# Open in browser
open tikz-draw.html
# or
xdg-open tikz-draw.html  # Linux
start tikz-draw.html      # Windows

Tools

Tool Shortcut Description
Select V Select and edit objects (click inside to select)
Move M Move objects independently (auto-clones shared coordinates)
Rotate O Rotate objects around their center (5° snap, Ctrl for 1° snap)
Point P Create coordinate points
Line L Draw line segments between points
Vector A Draw arrows/vectors between points
Circle C Draw circles (click center, drag radius)
Arc R Draw circular arcs
Rectangle B Draw rectangles
Label T Add text/LaTeX labels at points
Path H Draw multi-point paths
Curve Q Draw Bézier curves
Grid G Add a coordinate grid

Basic Workflow

  1. Create Points: Select the Point tool § and click on the canvas to place coordinate points. Each point gets a unique name (A, B, C, etc.)

  2. Draw Shapes: Use Line (L), Vector (A), Circle ©, or other tools. Most shapes reference existing points by name.

  3. Add Labels: Use the Label tool (T) to add text or LaTeX math at any point. Labels support full LaTeX syntax: $\frac{a}{b}$, $\alpha + \beta$, etc.

  4. Style Objects: Click inside any object to select it, then edit its properties in the right panel - colors, line styles, thickness, patterns, etc.

  5. Select Multiple Objects: With Select tool (V):

  6. Move & Adjust: Use the Move tool (M) to reposition objects, or use arrow keys to nudge selected objects for precise positioning. Works with single or multiple objects!

  7. Rotate Objects: Use the Rotate tool (O) to rotate objects around their center. Click and drag in a circular motion to rotate interactively (snaps to 5°), or hold Ctrl for finer 1° snapping. Note: Rectangles cannot be rotated.

  8. Copy & Duplicate: Copy objects with Ctrl+C and paste with Ctrl+V. Works with single or multiple objects - relationships are preserved!

  9. Export TikZ: Click “Export TikZ” (or Ctrl+E) to generate LaTeX code you can copy into your document.

Navigation

Properties Panel

Select any object to view and edit its properties:

Embedded Labels

Lines and vectors can have labels attached directly to them:

  1. Select a line or vector
  2. Click “+ Add Label” in the properties panel
  3. Click on the label entry to edit: text, position along the line (0-1), anchor, font size, color

Line Styles

Available line styles for all stroke objects:

Patterns

TikZ pattern library support for filled objects (Circle, Rectangle, Path):

Patterns use the fill color for pattern color. Export automatically includes \usetikzlibrary{patterns} note.

Arrow Types (Vectors)

LaTeX Labels

Labels support full LaTeX math notation via MathJax:

$\alpha$                           % Greek letters
$\frac{a}{b}$                      % Fractions
$\sqrt{x^2 + y^2}$                 % Square roots
$\int_0^\infty e^{-x} dx$          % Integrals
$\left[\frac{a}{b}\right]$         % Auto-sized brackets

Export Format

The exported TikZ code is clean and well-organized:

% Note: If using patterns, add to preamble: \usetikzlibrary{patterns}

\begin{tikzpicture}

% Coordinates
\coordinate (A) at (0, 0);
\coordinate (B) at (3, 4);
\coordinate (C) at (6, 0);
\coordinate (D) at (3, 0);

% Visible Points
\fill (A) circle (2pt);
\fill (B) circle (2pt);

% Segments
\draw (A) -- (B);
\draw[thick, dashed, red] (B) -- (C);

% Vectors
\draw[-Stealth] (A) -- (C);

% Circles
\draw[fill=blue, fill opacity=0.3, pattern=horizontal lines, pattern color=blue] (D) circle (1.5);

% Labels
\node[above] at (B) {$P$};

\end{tikzpicture}

Keyboard Shortcuts

Tools

Key Tool
V Select tool
M Move tool
O Rotate tool
P Point tool
L Line tool
A Vector (Arrow) tool
C Circle tool
R Arc tool
B Rectangle tool
T Label tool
H Path tool
Q Bézier Curve tool
G Grid tool

Editing

Key Action
Ctrl+C Copy selected object(s)
Ctrl+V Paste (with 0.5 unit offset) - maintains relationships
Ctrl+Z Undo
Ctrl+Y or Ctrl+Shift+Z Redo
Delete / Backspace Delete selected object(s)
Escape Clear selection / Cancel operation

Multi-Select (with Select tool V)

Action Method
Add to selection Ctrl+click object (Cmd on Mac)
Remove from selection Ctrl+click selected object again
Select multiple Ctrl+click objects one-by-one
Box select Drag on empty canvas
Clear selection Click empty space (no drag)

Nudging (when objects selected)

Key Action
Arrow Keys Nudge all selected 0.1 units
Shift + Arrow Keys Fine nudge all selected 0.01 units

Navigation

Key Action
Arrow keys (no selection) Pan the canvas
Mouse wheel Zoom in/out
+ / - Zoom in/out

File Operations

Key Action
Ctrl+S Save project
Ctrl+E Export to TikZ

Note: On macOS, use Cmd instead of Ctrl for all shortcuts.

Toolbar Buttons

The toolbar at the top of the application provides quick access to common operations:

Button states update automatically based on current selection and clipboard status.

Project Files

Save your work as JSON files to continue editing later:

Project files preserve all objects, positions, styles, and view settings.

Tips

Selection

Movement & Positioning

Rotation

Copy & Paste

Organization

Browser Compatibility

Works in modern browsers with ES6+ support:

Requires JavaScript enabled and internet connection (for MathJax CDN).

License

MIT License - feel free to use, modify, and distribute.

Contributing

Contributions welcome! Please open an issue or pull request on GitHub.