[Ethereum] How to convert big number to normal number


I am new to testing and I want to know how to convert a big number to a real number.

I use bignumber in the following command:

console.log(await this.crowdsale.rate());

This is what gets printed in the terminal:

BigNumber { s: 1, e: 2, c: [ 500 ] }

Best Answer

It depends what you mean by real number. You can check out here the divisions used in Ethereum.

For wei:

let bigNo = await this.crowdsale.rate();

For ether add this:


If you're using version ^1.0.0 of web3, use web3.utils.fromWei instead of web3.fromWei.

Related Topic