Javascript base number conversions

Convert Binary to Decimal in Javascript

parseInt("111", 2); // gives 7

Convert Decimal to Binary in Javascript

(value >>> 0).toString(2) // gives 111

Convert Binary to Hexadecimal in Javascript

parseInt("1111", 2).toString(16); // gives f

Convert Hexadecimal to Binary in Javascript

parseInt("f", 16).toString(2); // gives 1111

Convert Decimal to Hexadecimal in Javascript

parseInt(15, 10).toString(16); // gives f

Convert Hexadecimal to Decimal in Javascript

parseInt("f", 16).toString(10); // gives 15

Search within Codexpedia

Custom Search

Search the entire web

Custom Search