Palette maker

Black and White Gradient: Colors, CSS Codes and Print Tips

A black and white gradient fades from to , passing through a neutral gray near . In CSS it is linear-gradient(90deg, #000000, #FFFFFF).

Type
90°
 

More black and white gradients to try

On this page
  1. Color codes
  2. CSS code
  3. Gradient types
  4. Midpoint
  5. Banding
  6. Contrast
  7. Web and UI
  8. Creative uses
  9. Printing
  10. Palettes
  11. FAQ

The studio above lets you move the stops, rotate the angle, switch between linear, radial and conic, and copy the finished CSS. The sections below cover what the studio can’t show you: where the midpoint really lands, why stripes appear, which text colors survive on the ramp, and how it behaves in print.

Black, Gray and White: The Exact Color Codes

Black and white are the two ends of the lightness scale, and gray is whatever your eye reads in between. Every stop in this gradient is a pure neutral, which means the red, green and blue channels are always equal and there is no hue or saturation to manage.

Color HEX RGB HSL CMYK
Black 0, 0, 0 0°, 0%, 0% 0, 0, 0, 100
Gray 128, 128, 128 0°, 0%, 50% 0, 0, 0, 50
White 255, 255, 255 0°, 0%, 100% 0, 0, 0, 0

The CMYK numbers are the plain mathematical conversion. A real press or printer profile will change them, which is covered in the printing section.

Close relatives behave differently. A black to grey gradient stops short of white and keeps the whole surface dark, while a gray gradient lives in the middle of the scale with no true black or white at all. The full black to white ramp is the only one that uses the whole tonal range, which is why it works as a reference strip as well as a design element.

The Fastest CSS for a Black and White Gradient

Two color stops are enough. The keywords black and white are identical to and , so use whichever reads better in your stylesheet.

.ramp {
  background: linear-gradient(90deg, #000000, #FFFFFF);
}

Direction is set by the angle, and it is the part people mix up most often:

  • 0deg runs bottom to top, with black at the bottom.
  • 90deg runs left to right, the usual horizontal fade.
  • 135deg runs diagonally from top left to bottom right.
  • 180deg runs top to bottom, which is also the default if you give no angle.

You don’t need to add as a stop, because the browser creates it for you at 50%. Add stops only to change the shape of the fade. Holding the ends solid, for example, makes a punchier band: linear-gradient(90deg, #000000 25%, #FFFFFF 75%) keeps pure black on the left quarter and pure white on the right quarter, with the blend squeezed into the middle.

Linear, Radial or Conic: Which Shape Fits

Linear is the right choice for page backgrounds, hero sections and progress bars, because the eye reads it as a gentle change of light across a surface. Radial works as a spotlight or vignette. Putting white in the center and black at the edge, as in radial-gradient(circle at 30% 20%, #FFFFFF, #000000), gives you a soft glow that drifts off-center and looks less like a default.

Conic gradients sweep around a point, and they have one trap. conic-gradient(#000000, #FFFFFF) ends on white and restarts on black, so you get a hard seam at the top. Close the loop by returning to the start color:

.dial {
  background: conic-gradient(#000000, #FFFFFF, #000000);
}

That version suits dials, metallic knobs and brushed-steel buttons. For hard-edged stripes, use repeating stops with no blend, such as repeating-linear-gradient(45deg, #000000 0 10px, #FFFFFF 10px 20px). It is technically not a smooth gradient, but it is the same two colors and a common search companion.

Where the Midpoint Lands in sRGB, Linear Light and OKLab

By default, CSS blends in sRGB, so the halfway point averages 0 and 255 and lands at 127.5, which rounds to . That is the gray in the table above, and it is what the studio shows. Other color spaces give noticeably different middles for the same two endpoints:

  • sRGB (default): about , a balanced mid gray.
  • Linear light: about , much lighter, because it averages physical light rather than screen values.
  • OKLab: about , darker, because it spaces steps by how bright they look.

This explains why the same black to white ramp can look different in a 3D renderer or a video editor than it does in a browser. Those tools often blend in linear light, which pushes the midpoint up and makes the gradient look washed out in the center.

In plain CSS, what color sits at the 50% point of linear-gradient(90deg, #000000, #FFFFFF)?

Browsers blend in sRGB by default, so 0 and 255 average to about 128 on each channel.

If you want a perceptually even ramp in CSS, name the space: linear-gradient(in oklab 90deg, #000000, #FFFFFF). Current browsers support it, and older ones ignore the unknown syntax, so keep a plain sRGB line above it as a fallback.

How to Stop Banding in Smooth Grayscale Fades

An 8-bit display has only 256 gray levels between black and white. Stretch that ramp across a 1920 pixel wide hero and each level covers about 7.5 pixels, which is wide enough to see as faint vertical stripes on a good monitor. Banding is usually worst in the darks and on shallow ramps, where only a handful of levels are available.

Practical fixes, from most to least effective:

  1. Lay a faint noise texture over the gradient at 2 to 4% opacity, so the steps dissolve into grain.
  2. Export gradient images with dithering switched on (Photoshop and most export tools offer it).
  3. Avoid very shallow ramps, such as to , without a noise layer.
  4. Don’t over-compress a gradient JPEG, since heavy compression adds its own blocky steps.
.hero {
  background:
    url("noise.png"),
    linear-gradient(180deg, #111111, #F5F5F5);
}

Try this: Make a 1920 by 400 black to white strip, export it as PNG, then add a 3% noise layer and export again. View both on your phone at low brightness and see which one shows stripes.

Text Contrast on a Black and White Gradient

The extremes are easy: black on white is 21:1, the maximum possible. The midpoint is where it gets awkward. Gray on white is about 3.95:1, which fails the WCAG AA threshold of 4.5:1 for body text but passes the 3:1 threshold for large text. On black the same gray reaches about 5.32:1, so it passes.

Gray #808080 text on a white background has a contrast ratio of about 3.95:1. Is that enough for body text?

3.95:1 is below the 4.5:1 AA threshold for normal text, though it passes the 3:1 threshold for large text.

A gradient makes this harder because the background changes under the text. White text meets 4.5:1 only on backgrounds darker than about , which is roughly the first 46% of a left to right ramp. Beyond that point you need black text, and no single text color survives the whole width. I once audited a landing page where light gray captions sat across a black to white hero, and they vanished in the middle third. The fix was not a new color but a narrower gradient, ending at , so white text passed everywhere.

Black to white gradient bar split at #767676 showing white text passes on the first 46% and black text on the rest
White text passes 4.5:1 only up to #767676, about 46% across the ramp; after that, switch to black.

If you do need the full ramp behind text, put the text in one half, or place a semi-transparent dark scrim behind it. Check the actual pixel under each word rather than the two endpoints, since the endpoints will always look fine.

Two gradient bars with pinned hex stops showing white text failing past 46% on a full ramp but passing on a ramp capped at #404040
White text passes 4.5:1 only up to #767676, so ending the ramp at #404040 fixes it.

Black and White Gradients in Web and UI Design

The most useful job for this gradient on the web is the image overlay. A transparent to black fade at the bottom of a photo makes white captions readable without darkening the whole picture:

.card::after {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), transparent);
}

The same ramp works as a mask. Setting mask-image: linear-gradient(to bottom, #000000, transparent) fades an element out to nothing, which is cleaner than layering a white gradient over it because it works on any background. Skeleton loaders, scroll hints and tooltips use the same trick.

Keep the ends honest

Pure and on large screen areas can feel harsh. Starting at and ending at keeps the look but softens glare.

For dark interfaces, a black gradient built from near-blacks gives surfaces depth without going gray. For light interfaces, a white gradient from to adds a subtle lift to buttons and cards.

Branding, Fashion, Interiors and Art Uses

In branding, a black to white gradient is how you suggest chrome, steel and glass without introducing a hue. It pairs well with a single accent, such as the warm contrast in an orange and black scheme, or a cool tint like a dark blue gradient when you want the monochrome to feel like night rather than ink.

In fashion, the same fade appears as ombre and dip-dye, with fabric going from charcoal to near-white across a garment. In interiors it shows up as a graduated wall, painted dark at the floor and light at the ceiling, which is the one place where a hand-blended gradient beats a digital one. Warm grays such as read softer in a room than the neutral .

Artists have been working with this ramp for centuries as a value scale: a row of evenly spaced grays from black to white used to judge tone. Photographers use a similar idea in the Zone System, which divides the range into eleven zones. If you can see ten or eleven distinct steps in your own gradient, your tonal range is working.

Printing a Black to White Gradient Without Surprises

On screen, is the absence of light. In print, the plain conversion is 0, 0, 0, 100, a single layer of black ink, and it often looks dark gray rather than deep black. Designers add cyan, magenta and yellow for a rich black. A common starting recipe is C60 M40 Y40 K100, but the right values depend on the paper and the printer, so ask before you commit.

For gradients, keep the file in K only. Mixing a gray from CMY inks risks a color cast that shifts from batch to batch. I learned the other side of this on a poster job: our K-only fade to white looked flawless on screen but printed with a faint hard edge near the lightest 3% of the ramp, where the tiny dots disappeared. We fixed it by ending the fade at 5% black instead of 0.

Always request a proof. Screen white is brighter than any paper white, so a gradient that ends at will end at the color of the stock instead. Convert with the printer’s profile, not a generic one, and check the lightest and darkest steps first.

Four Monochrome Palettes Built on the Ramp

These palettes take the black to white range and shape it for particular jobs. Newsprint is the neutral workhorse. Warm Graphite and Cool Slate shift the grays a few degrees toward brown or blue, which keeps a design from looking like a default grayscale filter.

Newsprint

Editorial sites, blogs and reading apps that need calm, readable contrast.

Signal Red

Posters and landing pages where one red accent carries the call to action.

Warm Graphite

Interiors, packaging and fashion lookbooks that want softer, paper-like neutrals.

Cool Slate

Dashboards and dark mode interfaces with a faint blue cast.

Signal Red adds one saturated accent to an otherwise colorless set. If you want to explore that direction further, the red gradient page has matching reds with their codes.

The colors behind these gradients

Black and White Gradient: questions people ask

What is the CSS code for a black and white gradient?

Use background: linear-gradient(90deg, #000000, #FFFFFF); for a left to right fade. Change 90deg to 180deg for top to bottom, or swap the two colors to reverse it.

What color is in the middle of a black and white gradient?

In default CSS the middle is #808080, a neutral gray with RGB 128, 128, 128. If you blend in linear light it becomes about #BCBCBC, and in OKLab it becomes about #636363.

Why does my black to white gradient show visible stripes?

An 8-bit screen has only 256 gray levels, so a wide, slow fade shows steps called banding. Add a faint noise overlay, export with dithering, or shorten the distance the gradient has to cover.

How do I make a black and white gradient in Photoshop or Figma?

In Photoshop, press D to reset to black and white, pick the Gradient tool (G) and choose Foreground to Background. In Figma, add a Linear fill and set the two stops to #000000 and #FFFFFF.

Can I put text on a black and white gradient?

Only where the background stays on one side of the midpoint. White text passes WCAG AA on grays darker than about #767676, so keep it in the dark half or add a dark scrim behind it.

Keep exploring