Skip to content

Number

The Number category supports conversions between number bases such as binary, octal, decimal, and hexadecimal.

  • binary (base 2)
  • octal (base 8)
  • decimal (base 10)
  • hexadecimal (base 16)
console.log(convert.value(255).from("decimal").to("hexadecimal")); // "ff"
console.log(convert.value("1010").from("binary").to("decimal")); // "10"
convert.value(10).from("decimal").to("binary"); // "1010"
convert.value(10).from("binary").to("decimal"); // "1010"
convert.value("a").from("hexadecimal").to("decimal"); // "10"
convert.value(15).from("decimal").to("hexadecimal"); // "f"
convert.value(77).from("octal").to("decimal"); // "63"
convert.value(77).from("decimal").to("octal"); // "115"