# Heartbeat Loader

> A pulse line that traces across like a heart monitor, using an SVG stroke dash animation.

- Category: [CSS Loaders & Spinners](https://copy-css.com/category/loaders)
- Tags: heartbeat, pulse, ecg, svg, stroke, health
- Live preview: https://copy-css.com/snippets/heartbeat-loader
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<svg class="heartbeat" viewBox="0 0 120 40" role="img" aria-label="Loading">
  <path pathLength="100" d="M0 20H34L40 10 46 30 54 4 62 36 68 20H120"/>
</svg>
```

## CSS

```css
.heartbeat {
  width: 160px;
  height: 54px;
  overflow: visible;
}

.heartbeat path {
  fill: none;
  stroke: #ef4444;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 30 100;
  filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.7));
  animation: heartbeat 1.6s linear infinite;
}

@keyframes heartbeat {
  from { stroke-dashoffset: 30; }
  to { stroke-dashoffset: -100; }
}

@media (prefers-reduced-motion: reduce) {
  .heartbeat path {
    animation-duration: 3.2s;
  }
}
```

## Notes

- This CSS Heartbeat Loader is 27 lines of pure CSS (0.5 KB) with no JavaScript and no dependencies. It uses keyframe animations, filters and reduced-motion support.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
