CSS button generator
Start from a ready-made style and adjust color, size, corners and shadow. Hover and click the preview to see the effects, then copy the code.
How to useBeautiful CSS buttons
CSS button generator: what it is for
Choose a ready-made style (solid, pill, outline, gradient or square) and adjust the text, colors, font size, padding, corners, shadow, font weight and the hover effect (lift, darken or grow). The preview really works: hover and click it.
The CSS includes a visible focus state for keyboards, hover effects only on devices with a mouse and a slight shrink on click. The tool shows the contrast between text and background and warns you when it falls below 4.5:1.
How to use
- Choose a ready-made style.
- Adjust colors, size, corners, shadow and effect.
- Check the contrast and copy the CSS and HTML.
When to use it
- Call to action buttons on landing pages.
- Standardizing a site's buttons.
- Learning CSS by seeing the result.
Frequently asked questions
Is the button accessible?
The code uses the button tag (or a), keeps the focus outline visible with :focus-visible and the tool warns you when the contrast between text and background falls below 4.5:1, the WCAG minimum for normal text.
Why does the hover effect only show on desktop?
The hover is inside @media (hover: hover), because on phones a tap triggers a fake hover that gets stuck on the button. The click effect (:active) works on every device.
Can I use the code on a link?
Yes. Replace <button> with <a href="..."> and keep the class; the CSS already includes display:inline-flex and text-decoration:none for both cases.
Is it really free?
Yes, 100% free. No sign-up, no subscription and no usage limits. All Tools123 tools are free and run right in your browser.