CSS Checkbox Generator
Style a custom checkbox with your own size, border, colour and corners, using HTML and CSS that keep the real checkbox accessible.
How to style a custom checkbox
Set the look
Choose the size, border and corner radius.
Set the checked colour
The colour used when it is ticked.
Check the preview
It is shown ticked.
Copy the code
Copy the HTML and CSS blocks into your page.
Worked example
This is what CSS Checkbox Generator gives for its own sample values. Open the tool above and change anything to try your own.
- Size (px)
- 24
- Border colour
- #64748b
- Checked colour
- #0f766e
- Corner radius (px)
- 6
HTML
<label class="check"> <input type="checkbox"> <span class="box"></span> Remember me </label>
CSS
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; position: relative; }
.check input { position: absolute; opacity: 0; width: 24px; height: 24px; margin: 0; cursor: pointer; }
.box {
width: 24px; height: 24px;
border: 2px solid #64748b;
border-radius: 6px;
display: inline-grid; place-items: center;
transition: background 0.15s, border-color 0.15s;
}
.box::after {
content: "";
width: 6.72px; height: 12px;
border: solid #fff; border-width: 0 2px 2px 0;
transform: rotate(45deg) scale(0);
...About CSS Checkbox Generator
Style a checkbox to match your design while keeping the real input in the page. The tick is drawn with CSS and the box has a clear focus outline for keyboard users.
FAQs
Why not just style the default checkbox?
Browsers limit how much a native checkbox can change. A custom box beside a hidden real input gives full control.
Does it work with the label?
Yes. Clicking the label text toggles the box.
Can I use it as a radio button?
Change the input type to radio and set the radius to half the size for a round shape.