FormatterHQ

CSS Scrollbar Generator

Style the scrollbar for Chrome, Edge, Safari and Firefox at once: set width, track and thumb colors, hover color, radius and inset, and test it in a scrollable preview.

Loading tool…
Ready.

How to use the CSS Scrollbar Generator

  1. Set the scrollbar Width, Radius and Thumb inset with the sliders.
  2. Choose the Track colour, Thumb colour and Thumb hover colour.
  3. Leave Scope to class empty to style every scrollbar on the page, or enter a class name such as sidebar to limit it to one element.
  4. Scroll inside the preview box, both vertically and horizontally, to try the result.
  5. Copy or download the CSS, and the HTML tab if you scoped it to a class.

A CSS scrollbar generator for Chromium, Safari and Firefox

Browsers expose two different ways to style scrollbars, and this CSS scrollbar generator writes both, arranged so each browser uses the one that suits it best. The standard properties scrollbar-color and scrollbar-width are supported by Firefox and by Chrome and Edge from version 121. The non-standard ::-webkit-scrollbar pseudo-elements are supported by Chrome, Edge, Opera and Safari and allow more detail: exact width, rounded thumbs, hover colors and an inset.

Example output

With the default settings and a class of sidebar with an 8px width:

/* Standard properties (Firefox). Wrapped in @supports because Chromium 121+ ignores
   ::-webkit-scrollbar styles as soon as scrollbar-color/scrollbar-width are set. */
@supports not selector(::-webkit-scrollbar) {
  .sidebar {
    scrollbar-width: thin;
    scrollbar-color: #0f766e #f1f5f9;
  }
}

/* Chrome, Edge, Safari */
.sidebar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: #f1f5f9;
  border-radius: 8px;
}

.sidebar::-webkit-scrollbar-thumb {
  background-color: #0f766e;
  border-radius: 8px;
  border: 2px solid #f1f5f9;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background-color: #115e59;
}

With the class field empty the standard properties go on * inside the same @supports block, and the pseudo-elements are written without a selector, so every scrollable element and the page itself are styled.

Options explained

  • Width (2–24px) – sets both width (vertical bar) and height (horizontal bar). The standard scrollbar-width only accepts keywords, so the tool writes thin for 8px or less and auto above that.
  • Track, Thumb and Thumb hover colours – scrollbar-color takes the thumb first, then the track.
  • Radius – rounds both track and thumb.
  • Thumb inset – a border in the track color around the thumb, which makes it look like it floats inside the track.

Standard vs -webkit- scrollbars

Since Chrome and Edge 121, if an element has scrollbar-color or scrollbar-width set, those standard properties win and the ::-webkit-scrollbar rules are ignored for it. You would get your colors but lose the custom width, rounded thumb and inset. That is why the generated CSS puts the standard properties inside @supports not selector(::-webkit-scrollbar): Chrome, Edge, Opera and Safari support the pseudo-elements, skip the block and use the detailed ::-webkit-scrollbar rules, while Firefox, which has no pseudo-element support, applies the standard properties. Keep the two parts together when you paste them; removing the @supports wrapper brings the Chromium conflict back.

Tips

  • Keep it usable. Very thin bars and low-contrast thumbs are hard to grab and see. Keep a clear difference between thumb and track.
  • Overlay scrollbars change. On macOS, styling ::-webkit-scrollbar replaces the auto-hiding overlay scrollbar with a permanently visible one.
  • Layout shift. Add scrollbar-gutter: stable to reserve space so content does not jump when a scrollbar appears.
  • Class names are sanitized. Spaces and symbols become hyphens, so type a plain class name.

To convert the width to rem, use the px to rem converter; to pick matching colors, try the color palette generator.

Privacy

The CSS is generated in your browser. No settings are sent anywhere.

Frequently asked questions

Why is my custom scrollbar not showing in Firefox?
Firefox does not support ::-webkit-scrollbar at all. It only reads scrollbar-color and scrollbar-width, which give colors and a thin/auto/none width but no radius or hover color.
How do I hide the scrollbar but keep scrolling?
Use scrollbar-width: none for Firefox and current Chromium, plus ::-webkit-scrollbar { display: none; } for Safari and older Chromium. Only do this when there is another visible cue that the area scrolls.
Does ::-webkit-scrollbar work on mobile?
iOS and Android use thin overlay scrollbars that appear only while scrolling, and most scrollbar styling has little or no visible effect there. Treat custom scrollbars as a desktop enhancement.
Can I style the scrollbar of a textarea or a single div?
Yes. Enter its class name in the scope field, or change the generated selector to the element you need. The element must have overflow: auto or scroll and content larger than its box for a scrollbar to appear.

Last updated September 26, 2026

Related tools

CSS Animation Generator Generate CSS @keyframes animations — fade, slide, zoom, bounce, pulse, shake, spin and more — with duration, delay, easing and loop controls. CSS Background Pattern Generator Generate repeating CSS background patterns — stripes, polka dots, checkerboard, grid, zigzag and more — using only gradients, no images. CSS Border Radius Generator Set border-radius per corner in px or %, or shape organic blobs with the 8-value "fancy" border-radius syntax. Live preview and copyable CSS. CSS Box Shadow Generator Design layered CSS box-shadows with sliders for offset, blur, spread, colour and opacity. Supports inset shadows, presets and a Tailwind class. CSS Button Generator Design a CSS button with colours, gradient, padding, radius, border, shadow and hover/focus states, then copy clean HTML and CSS. CSS Clamp Generator (Fluid Typography) Calculate a CSS clamp() value that scales font size or spacing smoothly between two viewport widths, with a table of computed sizes. CSS Gradient Text Generator Fill headings with a colour gradient using background-clip: text. Pick two or three colours and an angle and copy cross-browser CSS. CSS Text Shadow Generator Generate CSS text-shadow effects — soft shadows, hard 3D offsets and neon glows — with live preview on your own text, then copy the CSS. CSS to LESS Converter Convert CSS to LESS online. Rules sharing a selector are nested automatically. CSS to SASS Converter Convert CSS to SASS online. Rules sharing a selector are nested automatically. CSS to SCSS Converter Convert CSS to SCSS online. Rules sharing a selector are nested automatically. CSS to Stylus Converter Convert CSS to Stylus online. Rules sharing a selector are nested automatically.