Handitab

CSS Switch Generator

Generate CSS for a toggle switch built on a real checkbox input, with your own width, on and off colors, and animation speed.

About CSS Switch Generator

A CSS toggle switch is a checkbox styled as a sliding control. This generator removes the native look with appearance: none, draws a pill-shaped track, and moves a round knob made from a pseudo-element when the input is checked. The height is always just over half the width. Adding role="switch" to the input tells screen readers to announce it as on or off instead of checked or unchecked.

How to use CSS Switch Generator

  1. Fill in "Width", "On color", "Off color" and "Animation speed".
  2. The result appears below and updates as you type.
  3. Copy the result with the copy button, or download it as a file where that is offered.

Questions about CSS Switch Generator

When should I use a switch instead of a checkbox?

Use a switch for a setting that takes effect immediately, such as turning notifications on. Use a checkbox when the choice is applied later with a submit button, or when several options can be selected from a list.

Runs in your browser. Page last updated .

More css and color tools

All 39 css and color tools