# Custom Checkbox

> A styled checkbox with a crisp checkmark, using appearance: none.

- Category: [CSS Form Elements](https://copy-css.com/category/forms)
- Tags: checkbox, check, form, appearance
- Live preview: https://copy-css.com/snippets/custom-checkbox
- License: Free for personal and commercial use. No signup, no attribution required.

## HTML

```html
<label class="checkbox">
  <input type="checkbox" checked>
  Remember me
</label>
```

## CSS

```css
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font: 16px system-ui, sans-serif;
  cursor: pointer;
}

.checkbox input {
  display: grid;
  place-content: center;
  width: 22px;
  height: 22px;
  margin: 0;
  border: 2px solid #9ca3af;
  border-radius: 6px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.checkbox input::before {
  content: "";
  width: 12px;
  height: 12px;
  background: #fff;
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
  transform: scale(0);
  transition: transform 0.15s ease;
}

.checkbox input:checked {
  border-color: #6366f1;
  background: #6366f1;
}

.checkbox input:checked::before {
  transform: scale(1);
}
```

## Notes

- This CSS Custom Checkbox is 40 lines of pure CSS (0.8 KB) with no JavaScript and no dependencies. It uses transitions, transforms, clip paths and CSS Grid.
- In JSX use `className` instead of `class`. In Tailwind projects put the CSS in the global stylesheet.
