The 7 Colors of the Rainbow in Order (With Hex Codes You Can Use)

The 7 Colors of the Rainbow in Order (With Hex Codes You Can Use)

From the outside edge of the arc inward: red, orange, yellow, green, blue, indigo, violet. That is the standard seven-color answer, remembered as Roy G. Biv, and it is the one to use if someone is marking a test or you are laying out stripes left to right.

Red sits on the outer part of the arc and violet on the inner side, which is how a primary rainbow is ordered in the sky. Drawn flat as a palette, that becomes red at the top or the left.

The part almost nobody publishes is the usable part: what those seven colors are in hex and RGB, which ones your screen and your printer cannot actually reproduce, and why the rainbow ramp is a poor choice for a chart legend. That is what the rest of this is.

The order, outer edge to inner edge

A vibrant double rainbow arcs over a lush green landscape with mountains in the background under a cloudy sky.

Red, orange, yellow, green, blue, indigo, violet. The mnemonic works in either direction - Wikipedia notes the initialism ROYGBIV is sometimes reversed as VIBGYOR, which is the order you would read a rainbow bottom-up. British schools also teach "Richard Of York Gave Battle In Vain."

The sequence is fixed because it is a physical sorting, not a design decision. When white light enters a raindrop, red light is refracted less than blue light, so the colors leave the drop at slightly different angles and arrive at your eye stacked in order. Red light at 750 nm exits at a radius angle of about 42.5°, and shorter wavelengths at a slightly tighter angle.

If you see a second, fainter arc about 10° outside the first, its colors run in reverse, red on the lower side. That bow comes from light reflecting twice inside each droplet, which flips the sequence. The dark strip of sky between the two is called Alexander's band.

Hex, RGB and CMYK values for the seven colors

Two rows of color swatches representing the seven colors of the rainbow, alongside a coffee cup and tools.

Use the bright set when you want the textbook rainbow - school printables, birthday graphics, a stripe divider. Use the softer set when the colors sit next to photography or body text, because full-saturation #00FF00 and #FFFF00 vibrate against almost anything and are hard to read text on.

ColorHex (bright)RGBSofter alternativeCMYK starting point
Red#FF0000255, 0, 0#D628280 / 100 / 100 / 0
Orange#FF7F00255, 127, 0#F77F000 / 60 / 100 / 0
Yellow#FFFF00255, 255, 0#FCBF490 / 0 / 100 / 0
Green#00FF000, 255, 0#43A04775 / 0 / 100 / 0
Blue#0000FF0, 0, 255#1D4ED8100 / 90 / 0 / 0
Indigo#4B008275, 0, 130#3F51B585 / 100 / 0 / 10
Violet#8B00FF139, 0, 255#7B2FBE70 / 85 / 0 / 0

The CMYK column is a starting point for a print file, not a match. Ink cannot hit those RGB values, and the two colors at the bottom of the list suffer most - more on that below.

Wavelengths, and the bands you cannot see

A rainbow is a continuous spectrum, and Wikipedia is explicit that the apparent discreteness of the bands is an artefact of human perception: the exact number of main colors is a somewhat arbitrary choice. The seven names are labels laid over a continuum, not measurements of it.

Within that continuum, red has the longest wavelength and violet the shortest, which is why red lands on the outside of the arc and violet on the inside. The bow also continues past both ends into near infrared and ultraviolet, but those bands are invisible to us - the UV band is sometimes picked up by cameras using black and white film.

Indigo is the band people argue about.

Why indigo is the weak link

Indigo is in the list because of Isaac Newton, not because of your eyes. Newton's 1672 division of the spectrum had five main colors: red, yellow, green, blue and violet. He added orange and indigo later to reach seven, by analogy with the seven notes of a musical scale, following a belief taken from ancient Greek sophists that the colors, the musical notes, the known planets and the days of the week were connected.

There is also a translation problem. Scholars have noted that what Newton called "blue" would today be called cyan, and what he called "indigo" would today be called blue. So the seven names are not wrong so much as four centuries out of date.

That is why the more modern seven-way split is red, orange, yellow, green, cyan, blue and violet. If you are building a palette rather than answering a quiz, that set is easier to work with - cyan #00BCD4 is a distinct, usable color, and #4B0082 next to #0000FF reads as one dark smudge at small sizes.

Why pink, brown, white, grey and black are not in it

A prism dispersing light into a rainbow on a table with various objects including a pink cup and black sphere.

Because none of them is a single wavelength of light. A rainbow is light sorted by wavelength, and it only contains colors that exist at one point on that scale.

  • Pink and magenta are mixtures of red and blue light from opposite ends of the spectrum. There is no single wavelength for them, so there is no place in the arc to put them.
  • Brown is dark orange - an orange with much of the light taken away. A rainbow is made of light being added, never subtracted, so it has no dark colors at all.
  • White is all wavelengths together, which is what the sunlight was before the raindrops separated it.
  • Grey and black are the absence of light. A bow cannot show you less light than the sky behind it.

This is also where a common classroom claim goes wrong. You will read that a rainbow's primary colors are red, yellow and blue. Mixing paint works that way; light does not. On a screen the additive primaries are red, green and blue, and the rainbow is not a mixture of any primaries - it is the unmixed original, spread out.

What screens and printers can actually show

Artistic workspace with color swatches, paint jars, and scissors on a wooden table.

Spectral violet and indigo cannot be reproduced faithfully on a normal sRGB monitor, and they get worse in CMYK print. Your screen makes colors by mixing three fixed lights, and pure single-wavelength violet sits outside the triangle those three lights can cover. #8B00FF is a stand-in that the brain accepts, not the real thing.

Practical consequences worth knowing before you send a file:

  • Do not print pure blue `#0000FF`. In CMYK it usually comes back as a dull purple. Shift to a cyan-leaning blue around #1D4ED8 or #0066CC and it will hold.
  • Violet and indigo drift toward navy on press. If the violet must stay violet, either lighten it toward #7B2FBE or budget for a spot ink.
  • `#00FF00` green has no ink equivalent. The closest CMYK mix is noticeably darker and slightly yellow. Pick that darker green yourself so you are not surprised.
  • Yellow on white loses its edges. For text, legends or thin stripes, drop to #FCBF49 or outline the shape.
  • Check the ends on a phone. Cheaper OLED panels oversaturate; the indigo-violet pair collapses into one color at thumbnail size, which matters for YouTube covers.

Rainbow ramps and color blindness

Color swatches arranged in two groups, showcasing various shades of blue, green, orange, and purple on a wooden surface.

A red-orange-yellow-green-blue ramp is one of the worst color schemes you can pick for a chart, a map or a status legend. Red and green are the pair most commonly confused, so the two ends of a rainbow legend can look identical to a viewer with red-green color vision deficiency - and the ramp also has no consistent lightness progression, so converting to greyscale scrambles the order.

If the rainbow is decorative, use all seven and enjoy it. If it carries meaning, do this instead:

  • Label values directly on the chart rather than making the reader consult a legend.
  • For ordered data - low to high - use a single-hue ramp that gets steadily darker, so it survives greyscale printing and photocopying.
  • For categories, cap it at five or six colors and vary lightness as well as hue. Pair #FCBF49 with #1D4ED8, not #43A047 with #D62828.
  • Add a second cue: pattern, icon shape, line style or position.
  • Never let red versus green be the only difference between "fine" and "broken."

Why drawn rainbows rarely match the real one

A sketchbook with a painted rainbow next to a photo of a rainbow on a wooden table, illuminated by a lamp.

Most illustrated rainbows get three things wrong, and once you know them you cannot unsee them. Stripes drawn at equal width; hard edges between colors; and violet placed on the outside of the arc.

A real bow is about 2° wide in total, and because the sun's disk is 0.5° across, the whole thing arrives pre-blurred - every band bleeds into its neighbors. Red and green dominate visually, blue is faint, and indigo and violet often merge into a single dim edge. In a photograph you will usually count three or four bands, not seven.

This matters when you write an image prompt or pick stock art. Ask for red on the outer edge of the arc, soft blending between bands, and a light haze against dark rain cloud; that reads as real. Ask for "seven bright stripes" and you get a decal.

Our Weather collection has a Rainbow subcategory alongside Rain, Storms and Clouds, and the Nature category covers the lakes, mountains and waterfalls that rainbows are usually photographed over. Everything there is AI-generated, royalty-free, and cleared for commercial use even on the free tier, which gives 5 downloads a day at 1600x900. Because it is machine-generated, check the arc before you publish: the physics is exactly the thing a model gets loosely right, so pick frames with red outermost and soft band edges.

Where the bow sits in the sky

A vibrant rainbow arcs over a lush green landscape with sheep grazing in a serene countryside setting.

Rainbows appear in the section of sky directly opposite the sun - the western sky in the morning, the eastern sky in the early evening - centered on the shadow of your own head. The arc's radius is 40-42°, so the sun's height decides whether there is a bow at all: above 42° elevation the whole circle drops below the horizon. That is why mid-morning and late afternoon are the windows, and why lower sun means a taller arc. The largest slice of the circle normally visible from the ground is about half, at sunrise or sunset.

That geometry is the thing to check in a stock frame or write into a prompt. Rain in front, sun behind the camera, the lit side of the landscape facing away from the arc, red on the outer edge. If a secondary bow is in shot it belongs about 10° outside the first with its colors reversed, and the dark band between them should be visible. Light in a primary bow is also 96% polarized tangential to the arc, which is part of why it can look oddly flat against a bright sky.

One exception to plan for: a moonbow is not colorful. Human color perception is poor in low light, so moonbows are usually perceived as white. If you need the arc in daylight this week rather than whenever the weather cooperates, the Rainbow subcategory in Weather is the shortcut.

Frequently asked questions

What are the 7 colors of the rainbow in order?

Red, orange, yellow, green, blue, indigo, violet - outer edge of the arc to inner edge. Remember it as Roy G. Biv, or reversed as VIBGYOR. Written as a vertical palette that is red at the top and violet at the bottom.

Is a rainbow 6 or 7 colors?

Seven is the answer expected in school, but the number is genuinely variable. Newton's first 1672 division had five colors; he added orange and indigo to reach seven by analogy with the notes of a musical scale. Wikipedia states plainly that the number of colors is variable and the choice somewhat arbitrary, and recent research suggests speakers of languages with fewer color words report fewer distinct bands.

Why is indigo not in the rainbow?

It is, but it is a very narrow band that most people cannot pick out from blue and violet on either side. The naming is also dated: scholars note that Newton's "indigo" is what we would now call blue, and his "blue" is closer to cyan. That is why the modern seven-way split often replaces indigo with cyan.

What are the real colors of the rainbow, in order?

A continuous spectrum with no boundaries in it, running red through violet. In a photograph you will usually make out three or four bands rather than seven, because the bow is only about 2° wide and the sun's 0.5° disk blurs every edge.

What hex code should I use for each rainbow color?

For the bright textbook set: #FF0000, #FF7F00, #FFFF00, #00FF00, #0000FF, #4B0082, #8B00FF. For layouts with text or photography, the softer set in the table above holds up better, and the last two are the ones to adjust for print.

Why is the second rainbow's color order reversed?

The secondary bow comes from light reflecting twice inside each droplet instead of once, which inverts the sequence. It sits about 10° outside the primary arc, at an apparent angle of 50-53°, with red on the lower side and only 90% polarization, which is part of why it looks fainter.

Why do rainbows appear where they do in the sky?

Always in the section of sky directly opposite the sun, centered on the shadow of your own head. The arc's radius is 40-42°, so if the sun sits above 42° elevation the whole circle drops below the horizon and no bow is visible against the sky.

What is the longest a rainbow has lasted?

The Guinness World Records holder is 8 hours 58 minutes, observed in the Yangmingshan range of Taipei, Taiwan, in November 2017. Most last minutes.

Final thoughts

The seven names answer the question. The hex values, the wavelength order and the gamut warnings are what let you build something with them - a printable, a stripe divider, a thumbnail, a set of chart colors that a color-blind reader can still read.

If you need the picture rather than the palette, the Rainbow subcategory in Weather is the place to start - and look at the arc itself before you publish, not just the colors.