A radix changes how an integer is written. The numeric value stays the same while its string representation changes.
Worked example
console.log((255).toString(16), Number.parseInt("ff", 16));Result
ff 255Implementation notes
Radix conversion does not pad values for fixed-width storage. For a colour channel such as hexadecimal 0f, decide width and casing after conversion.
Try it yourself
Convert 31 to base two and base sixteen, then parse each with the matching radix.
Open the JavaScript example →Editorial date September 10, 2025 · Published December 6, 2026