Color shapes how a website feels before anyone reads a word. Behind every shade on screen sits a code that tells the browser exactly what to display. Get that code wrong by a few digits and your brand blue turns into "almost the brand blue," which is how designers and developers end up arguing about which blue was meant.
This guide covers the color formats you'll actually use in HTML and CSS, when to pick each one, and how to build a palette that is readable and accessible. At the end, I'll share a free browser tool I use to pick, convert and save colors.
The same color in every format
Here is one color, a popular blue, written five ways:
Format Value
HEX #3B82F6
RGB rgb(59, 130, 246)
HSL hsl(217, 91%, 60%)
HSV 217°, 76%, 96%
CMYK 76, 47, 0, 4
They all describe the same color. The difference is which one is easiest to work with for a given job.
HTML color code formats explained
HEX
HEX is the most common format on the web: a hash sign followed by six characters, like #FF5733 .…