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
import { Conversion } from "@devhaven/unit-conversion";
const convert = new Conversion();
convert.value(255).from("decimal").to("hexadecimal")
convert.value(1010).from("binary").to("decimal")
convert.value(10).from("decimal").to("binary");
convert.value(10).from("binary").to("decimal");
convert.value("a").from("hexadecimal").to("decimal");
convert.value(15).from("decimal").to("hexadecimal");
convert.value(77).from("octal").to("decimal");
convert.value(77).from("decimal").to("octal");