Table of Contents

About

How to transform a decimal value to a binary.

See Bit - Binary to Decimal for the inverse

Method

Calculator

Windows calculator:

  • select the Programmer mode
  • select the DEC format
  • enter the decimal number
  • copy the BIN value

Windows Calculator

Javascript

Decimal to Binary to Hexadecimal

function numberRepresentation(decimal, binary, hexadecimal) {
  this.decimal = decimal;
  this.binary = binary;
  this.hexadecimal = hexadecimal;
}
numbers =[]
for (var i=0;i<=16;i++) {
   numbers.push(
       new numberRepresentation(
           i,
           i.toString(2),
           i.toString(16).toUpperCase()
       )
   );
}
console.table(numbers);