CSS Button Generator

Design a button visually and copy clean CSS and HTML, with a hover effect.

Enter your values

Result

CSS

.btn {
  display: inline-block;
  padding: 12px 24px;
  font-size: 16px;
  font-weight: 600;
  color: #FFFFFF;
  background-color: #4F46E5;
  border: none;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.2s ease, transform 0.1s ease;
}
.btn:hover {
  background-color: #2D22E0;
}
.btn:active {
  transform: translateY(1px);
}
HTML
<button class="btn" type="button">Get started</button>

The hover colour is your background colour made 8% darker (in HSL lightness), so the button reacts without you picking a second colour.

Live preview

How to use CSS Button Generator

  1. Enter button text, background and text colour.
  2. The result updates instantly as you type, with no button to press.
  3. Read the formula box to see how it was calculated, then copy the result.

Features

Instant results
Results update as you type, with no Calculate button and no page reload.
Formula explained
See exactly how the answer is worked out, so you can check it or learn the method.
Private & free
Everything runs in your browser. Nothing you enter is uploaded or stored.

Frequently asked questions

How does the CSS Button Generator work?

It uses this method: The hover colour is your background colour made 8% darker (in HSL lightness), so the button reacts without you picking a second colour.

Is this CSS Button Generator free?

Yes. It is 100% free, needs no sign-up and works on mobile and desktop. Your numbers never leave your device.

Free, no sign-up. Your files and numbers are processed in your browser and are not uploaded.

Related tools

View all

Share this Tool

Did CSS Button Generator work well for you?