Languages
[Edit]
EN

JavaScript - convert hex to int

4 points
Created by:
Geospatial-Palus
630

In this short article, we would like to show how to convert hexadecimal numbers (hex numbers) to integer numbers using JavaScript.

Quick solution:

// ONLINE-RUNNER:browser;

var hexNumber = '65e5';
var intNumber = parseInt(hexNumber, 16);  // <--- hex to int conversion

console.log(intNumber);  // 26085

or:

// ONLINE-RUNNER:browser;

var hexNumber = '0x65e5';
var intNumber = parseInt(hexNumber, 16);  // <--- hex to int conversion

console.log(intNumber);  // 26085

 

Alternative titles

  1. JavaScript - convert hex to dec
  2. JavaScript - convert hexadecimal to decimal
  3. JavaScript - convert hexadecimal number to decimal number
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.

JavaScript conversion

Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join