To convert hex to RGB, take the six-digit hexadecimal color code and divide it into three pairs representing red, green, and blue. Convert each pair from hexadecimal to decimal to get the RGB values. For example, the hex color #FF0000 converts to rgb(255, 0, 0), while #3366CC converts to rgb(51, 102, 204). Each RGB value ranges from 0 to 255.