HEX code can be used in RGB as well as CMYK without any problem. For your information, you can use the HEX code to identify any color in any format. The typical form of a HEX is a few letters along with digits. In most cases, it is a combination of six letters and digits.