This battery life calculator allows you to estimate the battery runtime. You can calculate how long the battery will last depending on the battery capacity and the amount of current consumed by the circuit. Below is the formula for the calculation:
battery life = capacity / consumption
Capacity is the capacity of your battery, generally measured in mAh which you can find printed on the battery.
Consumption is the average current draw of your electronic device, measured in amperes (A) or mA.