Palette maker

Red to Blue Gradient: Colors, Hex Codes and CSS

A classic red to blue gradient runs from to , and it passes through a deep purple, , at the halfway point. That purple is not a styling choice. It is simple arithmetic: the average of the two ends in screen color.

Type
90°
 

More red to blue gradients to try

On this page
  1. Hex codes
  2. The midpoint
  3. CSS code
  4. Smoother blends
  5. Web and UI
  6. Contrast
  7. Real uses
  8. Printing
  9. Vibration
  10. Palettes
  11. FAQ

I have built these blends into brand systems and app interfaces for 12 years, and the pure version is the one I reach for least and understand best. Use the studio above to move the stops, change the angle and copy the CSS, then read on for the exact codes, the contrast numbers and the print surprises that catch people out.

What a Red to Blue Gradient Is, in Exact Codes

Pure red and pure blue are two corners of the RGB color cube. Red is rgb(255, 0, 0) and blue is rgb(0, 0, 255), which is why both look so intense on a screen: each one switches a single channel fully on. Across the gradient, red fades out and blue fades in at the same rate.

Color HEX RGB HSL CMYK (basic)
Red 255, 0, 0 0°, 100%, 50% 0, 100, 100, 0
Purple (midpoint) 128, 0, 128 300°, 100%, 25% 0, 100, 0, 50
Blue 0, 0, 255 240°, 100%, 50% 100, 100, 0, 0

The CMYK column uses the plain mathematical conversion, so treat it as a starting point only. A real press cannot reproduce either end of this gradient at full strength, which I cover in the print section below.

Why the Middle Turns Purple Instead of Gray

Red and blue are not opposites on the color wheel, so they blend without a gray dead zone. Halfway across, the red channel has dropped to about 128 and the blue channel has risen to about 128, giving . It is darker than both ends, so the center of a pure red to blue gradient often reads as a shadow band.

What is the exact sRGB midpoint of #FF0000 and #0000FF?

Each channel is averaged: red falls to 128, blue rises to 128, and green stays at 0, which gives #800080.

Compare that with red to green, where the midpoint is a muddy olive, . If you want to see that for yourself, swap the blue end for pure green in the studio. The hue route matters too. The short way round the wheel goes from red through magenta to blue, while the long way passes through yellow, green and cyan, which is really a rainbow gradient in disguise.

Twelve-segment hue wheel linking red and blue through purple, with red and cyan opposites blending to gray
Red and blue sit 120° apart, so their midpoint is purple #800080; opposites like red and cyan blend to gray.

Red to Blue Gradient CSS You Can Paste

The simplest version needs two stops and an angle. Add the purple stop if you want the middle to be deliberate rather than accidental.

/* Two stops */
background: linear-gradient(90deg, #FF0000, #0000FF);

/* Three stops, purple anchor */
background: linear-gradient(90deg, #FF0000, #800080, #0000FF);

/* Radial glow */
background: radial-gradient(circle at 30% 30%, #FF0000, #0000FF);

/* Conic wheel, loops back to red */
background: conic-gradient(from 0deg, #FF0000, #0000FF, #FF0000);

Angles decide where the red sits. These are the four I use most:

  • 90deg (or to right): red on the left, blue on the right.
  • 180deg (or to bottom): red at the top, blue at the bottom.
  • 135deg: a diagonal from top left to bottom right, the most natural for cards and hero sections.
  • 270deg (or to left): reverses the horizontal blend, with blue on the left. Swapping the stops does the same.

Smoother Blends With oklch Interpolation

By default, CSS blends gradients in sRGB, which is why the middle goes dark. Modern CSS lets you pick the color space for the blend. Adding in oklch makes the browser interpolate lightness, chroma and hue instead of raw red, green and blue values.

background: linear-gradient(90deg, #FF0000, #0000FF);
background: linear-gradient(in oklch 90deg, #FF0000, #0000FF);

The first line is a fallback. A browser that does not understand the second line ignores it and keeps the first. In oklch the middle becomes a lighter, more vivid magenta-purple, with no dark band. Use in oklab for a softer, more muted middle, or add longer hue after oklch to force the rainbow route through yellow and green.

Softer Red and Blue Pairs for Websites and Apps

Fully saturated and are hard on the eyes across large areas, and the blue in particular looks heavy. For interfaces I swap them for tuned values. A reliable trio is (red), (violet) and (blue), which are the 600 steps in the Tailwind palette. A blue like royal blue is another easy substitute for the harsh pure end.

Keep gradients to buttons, banners, charts and hero sections, and keep body text on a plain surface. If the red feels too aggressive, bring it toward magenta: the pink to purple gradient page shows how that shift calms a design. On the other end, finishing in navy rather than blue gives a corporate, late-evening feel, and the dark blue gradient page has stops for it.

Contrast Ratios for Text on Red to Blue

I computed these WCAG contrast ratios from the relative luminance of each color. The level to beat is 4.5:1 for normal text and 3:1 for large text and interface components.

  • White on : 4.00:1 (fails for normal text, passes for large text)
  • White on : 9.42:1
  • White on : 8.59:1
  • Black on : 5.25:1
  • Black on : 2.44:1 (fails)
  • Red against blue : 2.15:1
Where the weak spot is

White text only struggles on the red end. Darken red to and it reaches about 5.0:1, which passes AA.

Which white text pairing passes WCAG AA for normal-size text?

White on #E00000 is about 5.0:1, while #FF0000 gives 4.00:1 and #FF6666 only about 2.9:1.

I hit this on a promo banner where the headline sat over the red third of the gradient. Darkening the red end from to fixed it, and nobody noticed the change except the accessibility audit. Also note the last ratio: red text on a blue background, or the reverse, is only 2.15:1, so never rely on that pairing to carry meaning.

Using Red to Blue in Branding, Interiors, Fashion and Art

Branding and UI

Red to blue suggests energy meeting trust: urgency on one side, calm on the other. It suits sports, music, gaming, fintech dashboards and event promotions. For a darker, premium feel, lay it over near-black, and the black gradient page shows how to build that backdrop.

Interiors and fashion

Paint does not blend by itself, so interiors usually borrow the gradient through ombre wall finishes, LED strips, rugs and glass. Fashion uses it as dip-dye and ombre fabric. A shift from deep red through plum to indigo is far easier to wear than the pure version.

Art and illustration

Painters get the purple middle for free, since red and blue pigments mix into violet. Watercolor artists wet the paper and let the two pigments run together, and the center turns out gentler than anything a screen produces.

Why Red to Blue Prints Duller in CMYK

Pure screen red and blue sit outside the range of ordinary CMYK inks. In Adobe’s default US Web Coated SWOP profile, C0 M100 Y100 K0 previews close to , and C100 M100 Y0 K0 close to . That blue is a deep indigo, nothing like the electric on your monitor.

Two panels compare screen red and blue hex codes with their darker CMYK print equivalents and blends
The same red and blue shift from vivid screen values to darker CMYK-safe ones in print.

I learned this on a poster proof for a client. The blue I had signed off on screen arrived as a dark indigo, and the gradient read as red to navy. Since then I design print gradients in CMYK from the start, soft proof before export, and ask the printer whether a spot ink for the blue is worth the cost.

Print rule

If the gradient will be printed, start from , and so what you see on screen is what the press can deliver.

Stopping the Vibrating Edge Between Red and Blue

Saturated red and blue at similar brightness can seem to shimmer or shift in depth when they touch, an effect known as chromostereopsis. A smooth gradient mostly avoids it because the transition is gradual. The trouble starts with hard edges, stripes, thin lines and small text sitting on the middle band.

The fixes are simple. Put text on a solid panel instead of directly on the blend, lower the saturation of one end, or add a thin white or dark keyline between hard-edged red and blue shapes. Widening the gradient also helps, because a cramped transition is where the effect is strongest.

Try this: Place the same white 18px heading over three versions: to , to , and to . Step back from the screen and see which stays readable at a glance.

Four Red to Blue Palettes to Borrow

These palettes are built around the same red and blue poles, tuned for different jobs. Stage Lights is the full-strength five-step ramp, good for banners and progress bars. Dusk Interface adds a dark indigo anchor and a pale tint, so you get a complete UI set rather than just a blend.

Stage Lights

Even five-step ramp for hero banners, event posters and loading bars.

Dusk Interface

Calmer app palette with a dark anchor and a pale background tint.

Pastel Haze

Soft wedding stationery, baby products and gentle social media backgrounds.

Proof Press

Colors that survive CMYK printing for flyers, packaging and merchandise.

Pastel Haze suits gentle products and stationery, and its middle sits close to lavender. Proof Press is the one to open when the job is going to a printer, since every stop stays within a range that CMYK can hold.

The colors behind these gradients

Red to Blue Gradient: questions people ask

What is the hex code for a red to blue gradient?

The pure version goes from #FF0000 (red) to #0000FF (blue), usually with #800080 as the purple midpoint. For interfaces, softer pairs such as #DC2626 to #2563EB look more refined and read better with text on top.

What color is in the middle of red and blue?

On screen, mixing equal parts of #FF0000 and #0000FF gives a dark purple, #800080. If you blend through hue instead of RGB values, the path runs through magenta, which is a brighter and pinker middle.

How do I write a red to blue gradient in CSS?

Use background: linear-gradient(90deg, #FF0000, #0000FF); for a straight blend. Add #800080 as a middle stop for a richer center, or add in oklch after linear-gradient( to get a smoother, brighter blend in modern browsers.

Is white text readable on a red to blue gradient?

White on pure #FF0000 reaches only 4.00:1, which fails WCAG AA for normal text. White on #E00000 reaches about 5.0:1, and white on the purple and blue parts of the gradient is well above 7:1.

Why does my red to blue gradient look dull when printed?

Pure screen red and blue sit outside what CMYK ink can reproduce. A press typically turns #FF0000 into something near #ED1C24 and #0000FF into a deep indigo near #2E3192, so design in CMYK and ask for a proof.

Keep exploring