1. Home
  2. Productivity tools
  3. CTA Button Generator

CTA Button Generator

For site owners who want an accessible button without writing the CSS by hand.

Free, no sign-up. Runs in your browser: nothing is uploaded.

Free workspace included. Docs, spreadsheets, notes and tasks that save on your device. No sign-up.Take a look

How to use CTA Button Generator

  1. Set the text, link and colours, or pick a preset.
  2. Check the preview, the hover colour and the contrast result.
  3. Copy the HTML and CSS.

Features

  • Live preview with a hover state
  • WCAG contrast ratio with AA and AAA results
  • Large-text rule applied when the text is large enough
  • Focus outline and reduced-motion support in the CSS
  • Your own class name, new-tab option and presets

Supported formats

Input

  • Typed text
  • Colour choices

You get

  • HTML
  • CSS

Private by design

Everything you enter is processed by your browser on this device. Nothing is sent to openWorkstand or anyone else, so the CTA Button Generator is safe for private and work data. After you have used it once while online, it also works without an internet connection. How local processing works

Good to know

  • Contrast is measured on the two colours you picked; it does not judge the page behind the button.
  • The CSS uses system fonts unless you change it.

Guide

Designing an accessible call-to-action button and its CSS

A call-to-action button is often the most important element on a page, and it is also where small design choices cause the most trouble: text that is hard to read, a hover state that is invisible or a button that cannot be reached by keyboard. This generator lets you set the look, checks the contrast against the Web Content Accessibility Guidelines and gives you clean HTML and CSS.

Settings

Choose the button text and link, a CSS class name, the background, text and hover colours with colour pickers, and sliders for corner radius, font size, vertical and horizontal padding, font weight and border width. Toggle a drop shadow, and choose whether the link opens in a new tab, which adds target="_blank" and rel="noopener noreferrer". Presets for blue, green, orange, dark and a pill shape give quick starting points.

The contrast check

WCAG 2 measures contrast as a ratio between the relative luminance of two colours, from 1 to 1 for identical colours to 21 to 1 for black on white. Level AA requires 4.5 to 1 for normal text and 3 to 1 for large text, which means at least 24 pixels, or 18.66 pixels in bold. Level AAA asks for 7 to 1 for normal text. The tool applies the right threshold for the font size and weight you have set and reports pass or fail in words.

The preview and hover

The preview draws your button with its real colours, and hovering over it shows the hover colour and a slight lift. That is how the generated CSS will behave. Keep an eye on both states: the text should stay readable when the background changes, and the change should be visible without relying on colour alone, which is why the CSS also moves the button slightly.

The code

The HTML is a single link with your class name. The CSS sets the display, padding, colours, font, border, radius, text decoration and cursor, the shadow if you chose one and a short transition. It adds a hover rule, a :focus-visible rule with a visible outline for keyboard users, and a prefers-reduced-motion rule that switches the transition and the lift off. Copy both and put the CSS in your stylesheet.

Worked examples

The default button, white text on #2563eb, has a contrast ratio of 5.17 to 1, and the tool says it passes. The size is 18 px and weight 700, which counts as large text, so the lower 3 to 1 threshold applies, and it also reaches 4.5 to 1. The orange preset uses white on #f59e0b; the ratio is just over 2 to 1, the tool says it does not pass and a stronger notice appears because the ratio is below 3 to 1. The generated HTML for the default is <a class="cta-button" href="https://example.com/signup">Start your free trial</a>.

Limits

Contrast is measured for the two colours you chose, not for the page behind the button, and text on images or gradients needs its own check. The CSS uses system fonts unless you change it. The tool does not test the button in context, nor does it make a page accessible by itself: focus order, labels and the wording of the button also matter. Test with a keyboard before publishing.

Checked against the current version of the CTA Button Generator on .

Troubleshooting

The download did not start

Look for your browser’s download bar or icon. Some browsers ask once before a site may download files; allow it and click the button again.

Frequently asked questions

Why does white text on orange fail?

Orange and amber are bright colours, so the difference in luminance between them and white is small, around 2 to 1. WCAG asks for at least 4.5 to 1 for normal text. Use a darker orange, or dark text such as near-black on the orange, and the ratio rises well above the limit.

Does the hover colour have to meet contrast too?

Yes, in practice. A hover colour that is lighter than the base can drop below the limit while the pointer is over the button. Pick a hover colour that is darker or equal in contrast, and check it by using the colour as the background in the contrast check.

What contrast ratio do I need?

WCAG 2 AA needs 4.5:1 for normal text and 3:1 for large text, which means 24 px or 18.66 px bold. AAA needs 7:1 for normal text.

What does the CSS include besides the colours?

A keyboard focus outline, a small colour and lift change on hover, and a rule that switches the movement off for people who ask their system for reduced motion.

Keep working with the result

After you download, choose “Save to Workstand” to keep the result in a folder on your computer, attach it to a project and create a follow-up task. It is saved by your browser, not uploaded.