Rainbow Color Codes (VIBGYOR): HEX, RGB, HSL & CMYK

The rainbow has seven colours: Violet, Indigo, Blue, Green, Yellow, Orange and Red (VIBGYOR, or ROYGBIV when read from red). Below are the standard rainbow hex codes and RGB values, plus HSL and CMYK. Click any code to copy it.

On this page: Color codes · Color converter · Gradient builder · Wavelengths · FAQ

Rainbow colour codes table

Copy RGB & HSL as

You'll copy 148, 0, 211 · HEX is always copied as #9400D3

ColourHEX codeRGB valueHSLCMYK
Violet
Indigo
Blue
Green
Yellow
Orange
Red

Copy the whole palette as

Rainbow HEX codes: #9400D3, #4B0082, #0000FF, #00FF00, #FFFF00, #FF7F00, #FF0000

Color converter

Choose a colour with the colour square, or type a code such as #FF69B4 or 255, 105, 180. You'll get the same colour in every format, ready to copy.

Start from a rainbow colour:

Your colour

Same colour in every format (click to copy)

HEX
RGB
HSL
CMYK

Rainbow gradient builder (CSS)

Build a rainbow gradient and copy the CSS. Switch between a smooth blend and hard stripes, or flip it to ROYGBIV.

background: linear-gradient(to right, #9400D3, #4B0082, #0000FF, #00FF00, #FFFF00, #FF7F00, #FF0000);

Wavelength of each rainbow colour

Approximate visible-light wavelengths. Violet has the shortest wavelength and red the longest, which is why VIBGYOR runs in that order.

ColourWavelengthHEX
Violet380–450 nm#9400D3
Indigo420–450 nm (often merged with violet)#4B0082
Blue450–495 nm#0000FF
Green495–570 nm#00FF00
Yellow570–590 nm#FFFF00
Orange590–620 nm#FF7F00
Red620–750 nm#FF0000

Rainbow colour code FAQ

What are the HEX codes for the rainbow colors?

The standard HEX codes for the seven rainbow colours (VIBGYOR) are: Violet #9400D3, Indigo #4B0082, Blue #0000FF, Green #00FF00, Yellow #FFFF00, Orange #FF7F00, Red #FF0000.

What are the RGB values of the rainbow colors?

The RGB values are: Violet rgb(148, 0, 211); Indigo rgb(75, 0, 130); Blue rgb(0, 0, 255); Green rgb(0, 255, 0); Yellow rgb(255, 255, 0); Orange rgb(255, 127, 0); Red rgb(255, 0, 0).

What does VIBGYOR stand for?

VIBGYOR stands for Violet, Indigo, Blue, Green, Yellow, Orange and Red, the seven colours of the rainbow listed from the shortest wavelength to the longest. ROYGBIV is the same list read from the red end: Red, Orange, Yellow, Green, Blue, Indigo, Violet.

Why does the rainbow have seven colours?

A rainbow is a continuous spectrum with no sharp colour boundaries. The count of seven goes back to Isaac Newton, who named seven colours, partly by analogy with the seven notes of the musical scale. Many people see only six, because indigo is hard to tell apart from blue and violet.

Are these rainbow color codes exact?

They are the commonly used digital approximations. A real rainbow is made of pure spectral light, and some of those colours, violet especially, cannot be reproduced exactly on an RGB screen. How a code looks also depends on your display.

How do I use the rainbow colors in CSS?

Use the HEX codes directly, for example color: #9400D3;, or build a rainbow with a gradient: background: linear-gradient(to right, #9400D3, #4B0082, #0000FF, #00FF00, #FFFF00, #FF7F00, #FF0000);. The gradient builder on this page generates the CSS for you.

Was this page helpful?

Need a web or mobile product built? See what I do.