Zero Signup ToolsFree browser tools

Developer Tools

SVG Stroke Dasharray Calculator

Measure any SVG path length and generate ready-to-copy stroke-dasharray, stroke-dashoffset, and draw-in animation CSS in your browser.

Quick presets

Live preview

Total length
0
stroke-dasharray
0
stroke-dashoffset
0

Length is computed using the browser's own SVGGeometryElement.getTotalLength(), in user units that match the viewBox. The same number drives the dasharray, the dashoffset, and the CSS animation.

CSS output

Ready-to-paste rule. The keyframes use the measured length directly, so the animation finishes the moment the dash empties.

/* Add a valid shape or path to compute the dasharray. */

SVG markup

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 160" width="300" height="160">
  <path class="path" d="M20 80 C 40 30, 80 30, 100 80 S 160 130, 200 80 C 220 50, 260 50, 280 80" />
</svg>

React style

{}

Tailwind classes

/* Add a valid shape to generate Tailwind classes. */

Shape

Pick a shape preset or paste any SVG path d attribute. Custom paths run through the same length measurement.

Animation

The duration is the time the dash takes to fully draw or erase. The preview replays whenever you tweak any input.

Direction
Empty to full, the path appears as it draws
Stroke color

How to use

  1. Pick a preset (Signature, Checkmark, Spinning circle, Rounded outline, Underline, Star outline) or pick a shape mode and enter the geometry.
  2. For custom paths, paste the d attribute exactly as it appears in your SVG. For shapes, enter the center, radius, dimensions, or points.
  3. Tune the animation: duration in seconds, easing, repeat mode (once, loop, ping pong), and direction (draw in or draw out).
  4. Watch the live preview to confirm the draw timing reads correctly at the stroke width and viewBox you plan to ship.
  5. Copy the CSS rule, the SVG markup, the React style object, or the Tailwind class pair into your project.
  6. Hit Replay any time to retrigger one-shot animations without changing inputs.

About this tool

SVG Stroke Dasharray Calculator measures the exact length of any SVG path and generates the stroke-dasharray, stroke-dashoffset, and CSS animation block needed to make the path draw itself in (or erase itself out) the way illustrators, motion designers, and frontend developers use across hero sections, signatures, checkmarks, loading spinners, animated diagrams, and onboarding flows. Drawing animations work because SVG dashes are computed from a single number: the total length of the rendered path in user units. Set stroke-dasharray to that length and stroke-dashoffset to the same value, animate the offset down to zero, and the dash retracts so the path appears to draw itself. Eyeballing the number does not work, and the wrong length produces an animation that pops, jumps, or finishes short of the end. This tool reads the length directly from the browser using SVGGeometryElement.getTotalLength(), the exact function the SVG renderer uses internally, so the dasharray you copy matches what the browser will draw. Six shape modes cover the real cases: paste a custom d attribute from Figma, Illustrator, or a code snippet; sketch a straight line with two endpoints; build a rounded rectangle outline (sides plus four arcs) with adjustable corner radius; draw a perfect circle from a center and radius; draw an ellipse with separate rx and ry; or paste a polyline points list for stars, arrows, signatures, and zigzags. Every shape is flattened into a single path d string under the hood, so the measurement runs through the same path API regardless of which mode you picked. The animation controls cover everything you actually tweak in real projects: duration in seconds, optional delay, easing (linear, ease, ease-in, ease-out, ease-in-out, and two cubic-bezier curves from common UI kits), once or loop or ping-pong repeat, draw-in or draw-out direction, stroke width, and stroke color. The live preview replays on every change so you can see exactly how the dash advances, and a Replay button lets you re-trigger one-shot animations without changing inputs. Output is shown in four ready-to-paste formats: a CSS rule with the keyframes block, an SVG markup snippet that already uses the .path class, a React inline style object, and a Tailwind arbitrary-value class pair for stroke-dasharray and stroke-dashoffset. The stroke color defaults to currentColor in the copied output so you can theme the path with a parent class. Everything runs in your browser, so the paths, signatures, and SVG snippets you measure here never leave your device.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsDeveloper Tools