It's generally recommended to use hexadecimal codes in HTML for maximum compatibility across web browsers. However, using color names can make your code more readable and easier to understand.