HTML color codes are hexadecimal triplets to represent RGB (Red, Green, and Blue) colors in the format (#RRGGBB). For example, red is #FF0000, which is '255' red, '0' green, and '0' blue. By varying the red, green, or blue values, you can create up to 16.7 million HTML and CSS color codes.