HEX to RGB
Split the code into three pairs and read each as a base-16 number, where A to F stand for 10 to 15. For #FF5733: FF = 15 × 16 + 15 = 255, 57 = 5 × 16 + 7 = 87, 33 = 3 × 16 + 3 = 51, so the color is rgb(255, 87, 51). A three-digit code doubles each digit: #F53 is #FF5533.
RGB to HEX
Write each value from 0 to 255 as two base-16 digits: 255 = FF, 87 = 57, 51 = 33, giving #FF5733. Divide by 16 for the first digit and take the remainder for the second: 87 ÷ 16 = 5, remainder 7.
The simple RGB to CMYK formula
Divide R, G and B by 255. Then K = 1 − the largest of them, and C = (1 − R − K) ÷ (1 − K), M = (1 − G − K) ÷ (1 − K), Y = (1 − B − K) ÷ (1 − K). Going back, R = 255 × (1 − C) × (1 − K), and the same for G with M and B with Y. This is the formula most converters use; it suits screens and quick estimates, not presses.
HSL, Lab and OKLCH
These follow the conversion steps in CSS Color Module Level 4. Lab uses a D50 white point, as CSS and Photoshop do, so values match what those show.