CSS Toggle Switch Generator

Design accessible on/off toggle switches in pure CSS — size, colours and shape — and copy the HTML and CSS.

Runs instantly in your browser — results update as you type.

How do I make a toggle switch with HTML and CSS?

Set the width, height, colours for on and off, the knob colour, the gap and the shape, then click the live preview to test it. The code uses a real checkbox with role="switch", so it works with the keyboard, screen readers and forms without any JavaScript.

How to use the CSS Toggle Switch Generator

    Frequently asked questions

    Does it need JavaScript?

    No, it is pure HTML and CSS.

    Can I have several switches?

    Yes, reuse the same class on as many labels as you like.

    Is it free?

    Yes.