Overview
Managing token decimals is critical when working with HBAR, HTS tokens, and ERC tokens on Hedera, as each system has distinct precision standards. These differences impact how token balances are calculated, displayed, and transferred across various tools and environments.Token Decimal Comparison and API Context
The table below compares the decimal handling of HBAR, HTS tokens, and ERC tokens on Hedera, incorporating details about their representation across APIs and services. This overview highlights differences in precision and context.| API/Service | Decimals | Explanation |
|---|---|---|
| Hedera API (HAPI) | 8 decimals | HBAR is represented with 8 decimal places, aligning with its native smallest unit tinybar. |
| Hedera Smart Contract Service (EVM execution) | 8 decimals | Within the EVM, HBAR is tinybar-scaled: msg.value, address(this).balance, and the value passed to call/send/transfer are all 8 decimals during execution. |
| JSON-RPC Relay (Arguments) | 8 decimals | When HBAR values are passed as arguments in JSON-RPC calls, they are represented with 8 decimal places. |
JSON-RPC Relay (msg.value / gasPrice) — RPC boundary only | 18 decimals | Ethereum tooling submits and reads the transaction value and gasPrice in 18-decimal weibar at the JSON-RPC boundary. The relay converts weibar to tinybar (÷1010) before the EVM executes, so the msg.value your contract actually sees is 8-decimal tinybar — not 18-decimal wei. See the warning below. |
| HTS Tokens | Configurable (up to 8 decimals) | HTS tokens allow token creators to define precision at token creation, offering flexibility for various use cases. |
| ERC Tokens | Default 18 decimals | ERC tokens on Hedera follow Ethereum token standards, with 18 decimals as the default unless specified otherwise. |
- Account for scaling differences when converting HBAR between APIs, especially when using JSON-RPC.
- HBAR fees are always calculated in tinybars, regardless of the API or service used.
- The 18-decimal representation is a JSON-RPC boundary convention only — inside the EVM, native value is tinybar (8 decimals). Do not assume
msg.valueis wei-scale (see warning).