Skip to content
M2TOOLKIT

CSS Button Generator

Design a button visually and copy production-ready CSS.

Use it as often as you like — it's free, with no sign-up and no limits.

  • Design
  • Free
  • No sign-up
  • Nothing is sent or stored
  • Updated
pill
24px
12px
16px
30%
0px

The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved.

How to use the CSS Button Generator

  1. Set the text, colours and shape.
  2. Adjust padding, font, shadow and hover effect — hover the preview to test it.
  3. Copy the CSS and HTML into your project.

What does this tool do?

Buttons are the most-clicked element on most sites, so they deserve care: enough padding to tap on a phone, strong colour contrast and a clear hover and focus state.

The generated CSS includes a visible :focus-visible outline so keyboard users can see where they are.

Why use it?

  • Live hover preview.
  • Gradients and borders.
  • Accessible focus style included.

Use cases

  • Primary call-to-action buttons for landing pages.
  • Consistent button styles for a design system.
  • Quick styled buttons for emails and prototypes.

Accessible button basics

Aim for at least 44 × 44 px of tap area (about 12–16 px of vertical padding), a text-to-background contrast of 4.5:1 or more, and a visible focus outline. Hover effects should add to, not replace, a clear default look.

Common mistakes

  • Removing the focus outline, which leaves keyboard users lost.
  • Light text on a light gradient that fails contrast.
  • Tiny buttons that are hard to tap on phones.

Privacy

The calculation happens instantly in your browser. The numbers you enter are not sent to our servers or saved. There's no account to create and nothing to install.

Frequently asked questions

Should I use <button> or <a>?

Use <button> for actions on the page and <a> for links that go somewhere.

How do I add an icon?

Place an SVG inside the button and add a small gap between the icon and the text.

Will the CSS work in all browsers?

Yes, it uses widely supported properties like border-radius, box-shadow and transform.

Content last updated . See how M2Toolkit works.

Other tools people use alongside the css button generator.