All features

Live preview, with click-to-code

The drawing sits beside its code and redraws a moment after you stop typing. Click a shape in the picture and its code is selected; put the cursor in the code and its shape lights up. Drag a shape to move it, or its handles to resize it, and the code changes with it. Zoom in on detail, and switch the background to see exactly what is transparent.

Try it with a sample drawing

Opens three half-transparent circles. Click one to find its code, Ctrl+scroll to zoom, and switch the background to see what shows through.

Click a shape, find its code

Click a shape in the preview and the editor selects its element; hovering highlights what a click would pick. The first click picks the whole group the shape belongs to, and each further click goes one level deeper, down to the shape itself. It works the other way too: move the cursor in the code and the element under it glows in the picture, which is the quickest way to find out what a line draws. Ctrl+click picks several shapes.

With a shape selected in the preview, Del removes its element from the code, and Ctrl+Z puts it back.

A circle clicked in the preview, highlighted there, with its line selected in the code.
A circle clicked in the preview, highlighted there, with its line selected in the code.

Move and resize by hand

Drag a shape to move it, or drag one of the handles around it to resize it. Shift keeps its proportions, and Esc during a drag puts it back where it was. The arrow keys move the selection by one unit, ten with Shift.

Each change is written into the code the way you would write it yourself: a rectangle's x and width, a circle's cx and r, a traced path's translate. Nothing else in the file is touched, and one Ctrl+Z undoes a whole drag. Shapes that have no position of their own, such as paths, groups and text, are moved and resized with a transform.

The sun dragged across the sky and enlarged from a corner handle, with its new cx, cy and r in the code.
The sun dragged across the sky and enlarged from a corner handle, with its new cx, cy and r in the code.

Zoom and backgrounds

Zoom with the toolbar, with Ctrl and the scroll wheel, or by pinching on a touchpad or a touch screen, from 1% up to 5000% and beyond. Once the drawing is larger than the pane, the wheel zooms toward the pointer and keeps the spot under it in place; until then the drawing grows from its middle. The toolbar keeps the middle of the view where it was. Fit to window shows the whole drawing, and the right mouse button drags the view around. A drawing larger than the pane is fitted when it opens.

The background can be a light or a dark checkerboard, white or black. The checkerboards show what is transparent; the solid ones show how a drawing looks on a light or a dark page.

The same drawing on the four backgrounds: light checkerboard, dark checkerboard, white and black.
The same drawing on the four backgrounds: light checkerboard, dark checkerboard, white and black.

Safe to open anything

An SVG can carry scripts. The preview removes them, and event handlers and embedded HTML with them, before drawing — in the picture only. Your code, the saved file and every download stay exactly as you wrote them. A drawing's own CSS is kept, and is contained so it cannot restyle the page around it.

A drawing with no viewBox, or with shapes outside its own bounds, is still shown whole, sized from what it actually draws.

Good to know

  • Moving and resizing work on one shape or group at a time, and not on a phone.
  • Shapes can be moved and resized, not rotated. Resizing a path, a group or text scales its outline too.
  • A shape positioned by CSS, or animated, cannot be dragged. Change it in the code instead.
  • The preview redraws 300 milliseconds after you stop typing, not on every key.
  • The background choice resets when the page is reloaded.

Questions

Why does my drawing show here but not in my app?

The preview reads markup the forgiving way a web page does, so an SVG missing its xmlns declaration, for example, still shows. A standalone .svg file or an <img> needs it. Exporting the drawing as a data URI adds what is missing.

Does dragging a shape rewrite my file?

No. Only the attributes of the shape you moved change, where they stand. Formatting, comments and everything else stay as they were.

Can a pasted SVG run code on the page?

No. Scripts and event handlers are removed before the preview draws it.