What is a CSS button generator?
A CSS button generator lets you design a button with controls instead of writing styles by hand. You see the result immediately, including how it reacts when hovered and clicked, then copy code that works in any website or framework.
Choose a solid colour or gradient, text colour, padding, font size and weight, corner radius, border and shadow, and whether it lifts on hover. Five presets cover common styles to start from. The CSS includes hover, active and keyboard focus states.
How to use the CSS button generator
1.Start from a preset
Solid, pill gradient, outline, dark or brutal.
2.Style it
Colours, padding, font size and weight, radius, border, shadow and hover effects.
3.Copy the CSS
Normal, hover, active and focus-visible rules in one block.
Example: a primary action button
The Solid preset with the default sizes:
- Background / text
- #2547d0 / white
- Padding
- 12px 24px
- Font
- 16px, weight 600
- Hover
- 10% darker, lifts 2px
A clear blue button that darkens and rises slightly on hover, with a blue focus ring for keyboard users.
All the states a button needs
A finished button needs more than a colour: a hover change so it feels clickable, an active state for the moment of the click, and a clear focus outline for people using a keyboard. The generated CSS includes all four, with smooth transitions.
The hover colour is worked out from your background automatically: most colours darken, while very dark buttons lighten so the change stays visible.
Frequently asked questions
Why is there a focus-visible rule?
It shows an outline when someone tabs to the button with a keyboard, without showing it on mouse clicks.
How do I make a pill button?
Drag Corner radius to the end; it becomes a fully rounded pill.
Can I use it on links?
Yes. Add the class to an a element and it looks the same.
Is the preview the real CSS?
Yes. The preview button uses exactly the CSS shown, so hover and click to test it.
Related tools
CSS Box-Shadow Generator
Layered, inset and soft shadows with a live preview.
CSS Gradient Generator
Linear, radial and conic gradients with up to six stops.
Neo-brutalism generator
Bold flat cards and buttons with thick outlines and hard shadows.
CSS Border-Radius Generator
Rounded corners, linked or per-corner, in px or %.
CSS clamp() Generator for Fluid Sizes
Fluid font sizes and spacing that scale between two viewport widths.
CSS text-shadow generator
Glow, outline, 3D and retro text effects with CSS text-shadow.
More Developer tools
JSON & data
CSV tools
Network & system
Web & API
Git & releases
Encoding & security
- Base64 encode & decode
- URL encode & decode
- JWT decoder
- Hash generator
- HTML entity encoder
- Text to binary
- Morse code translator
- Caesar cipher & ROT13
- Random string generator
- Secret key generator
- 2FA code generator (TOTP)
- Encrypt & decrypt text
- Encrypt & decrypt files
- SSH key generator
- Base32 encoder and decoder
- Unicode escape converter
- Nano ID generator
- JWT generator
Text & code
- Regex tester
- Text diff checker
- Cron expression explainer
- Lorem ipsum generator
- Markdown previewer
- Slug generator
- Strip HTML tags
- Unicode character inspector
- URL parser
- Markdown TOC generator
- cURL converter
- Whitespace visualizer
- Markdown link extractor
- Regex escape
- Regex match extractor
- Split text by regex
- HTML, CSS and JS playground
- Mock data generator
- Keyboard event tester
- ASCII table