<p>The average amount of time (in seconds) to find a single share is:</p>

<pre><code>difficulty * 2^32 / hashrate
</code></pre>

<p>In that equation, difficulty is the difficulty of a share and hashrate is your hash rate in hashes per second.  A day has 86,400 seconds in it, so the number of shares you'll find in 24 hours is:</p>

<pre><code>86,400 / (difficulty * 2^32 / hashrate)
</code></pre>

<p>A slightly more complex formula, using PHP:</p>

<pre><code>$hashTime = ((float) $difficulty) * (pow(2.0, 32) / ($hashRate * 1000.0)) ;
$powerCostPerYear = 365.25 * 24.0 * $powerConsumption / 1000.0 * $electricityRate;
$blocksPerYear =  (365.25 * 24.0 * 3600.0) / $hashTime ;
$coinsPerYear = $blockCoins * $blocksPerYear;
$revenuePerYear = $coinsPerYear * $conversionRate;
$profitPerYear = $revenuePerYear - $powerCostPerYear;
$netProfit1st = $revenuePerYear - $costHardware - $powerCostPerYear;
if ($profitPerYear &lt;= 0) $breakEvenTime = -1;
else $breakEvenTime = $costHardware / ($profitPerYear / (365.25 * 24.0 * 3600.0));
</code></pre>

CC BY-SA 3.0
2013-03-22T15:24:48.267Z
There are some unstated things in this formula, like $electricityRate should be in dollars per kilowatt hour, or that $hashRate is measured in Khash/s. If you documented those things, this would be a great answer.
Nick ODell
CC BY-SA 3.0
2014-05-13T15:25:12.397Z
What the heck is a share? How many shares are there per bitcoin? Where does the difficulty number come from? This answer seems quite incomplete.
Qwertie
CC BY-SA 3.0
2016-05-22T13:23:07.963Z
Can you explain or reference where the 2^32 number comes from and how it's calculated?
nallenscott
CC BY-SA 4.0
2019-09-08T18:28:59.923Z
@nallenscott I think because the first 32 bits are always 0. Those bits are not in the float representation, which is how the difficulty is often displayed.

"The Bitcoin protocol represents targets as a custom floating point type with limited precision; as a result, Bitcoin clients often approximate difficulty based on this (this is known as "bdiff")."
https://en.bitcoin.it/wiki/Difficulty#How_soon_might_I_expect_to_generate_a_block.3F
Dave
CC BY-SA 3.0
2013-03-22T13:00:20.617Z
2013-03-22T13:00:20.617Z
CC Inc
<p>You effectively need a spreadsheet to calculate the profit because the difficulty factor changes every 2016 blocks, or about every two weeks.  The difficulty factor is currently compounding itself somewhere around 35% to 55% per month.  If you don't include this nonlinear effect you are kidding yourself. The compounding difficulty factor is the dominant term that will make or break ROI.</p>

CC BY-SA 3.0
2013-12-27T21:09:58.307Z
2013-12-27T21:09:58.307Z
skaht
<p>I'm a newbie. </p>

<p>What is the basic equation for computing profit from mining given gigahash per second of the miner, timeframe, miner costs, and current bitcoin economy stats like mining difficulty and dollars per coin?</p>

<p>And what are some URLs that have these stats always up to date?</p>

<p>I'm looking for the equation, not an online calculator. </p>

<mining-profitability>
Equation for mining profit
Troy toy
# Equation for mining profit

(Asked by: username_0 on 2013-03-21)

I'm a newbie.

What is the basic equation for computing profit from mining given gigahash per second of the miner, timeframe, miner costs, and current bitcoin economy stats like mining difficulty and dollars per coin?

And what are some URLs that have these stats always up to date?

I'm looking for the equation, not an online calculator.

**Tags:** mining-profitability


---

## 2 answers

### Answer by username_1 on 2013-03-22. Score: 11

The average amount of time (in seconds) to find a single share is:

```
difficulty * 2^32 / hashrate

```

In that equation, difficulty is the difficulty of a share and hashrate is your hash rate in hashes per second. A day has 86,400 seconds in it, so the number of shares you'll find in 24 hours is:

```
86,400 / (difficulty * 2^32 / hashrate)

```

A slightly more complex formula, using PHP:

```
$hashTime = ((float) $difficulty) * (pow(2.0, 32) / ($hashRate * 1000.0)) ;
$powerCostPerYear = 365.25 * 24.0 * $powerConsumption / 1000.0 * $electricityRate;
$blocksPerYear =  (365.25 * 24.0 * 3600.0) / $hashTime ;
$coinsPerYear = $blockCoins * $blocksPerYear;
$revenuePerYear = $coinsPerYear * $conversionRate;
$profitPerYear = $revenuePerYear - $powerCostPerYear;
$netProfit1st = $revenuePerYear - $costHardware - $powerCostPerYear;
if ($profitPerYear <= 0) $breakEvenTime = -1;
else $breakEvenTime = $costHardware / ($profitPerYear / (365.25 * 24.0 * 3600.0));

```

> **Comments:**
> **username_2**: There are some unstated things in this formula, like $electricityRate should be in dollars per kilowatt hour, or that $hashRate is measured in Khash/s. If you documented those things, this would be a great answer.  
> **username_3**: What the heck is a share? How many shares are there per bitcoin? Where does the difficulty number come from? This answer seems quite incomplete.  
> **username_4**: Can you explain or reference where the 2^32 number comes from and how it's calculated?  
> **username_5**: @username_4 I think because the first 32 bits are always 0. Those bits are not in the float representation, which is how the difficulty is often displayed.  "The Bitcoin protocol represents targets as a custom floating point type with limited precision; as a result, Bitcoin clients often approximate difficulty based on this (this is known as "bdiff")." https://en.bitcoin.it/wiki/Difficulty#How_soon_might_I_expect_to_generate_a_block.3F  

---

### Answer by username_6 on 2013-12-27. Score: 2

You effectively need a spreadsheet to calculate the profit because the difficulty factor changes every 2016 blocks, or about every two weeks. The difficulty factor is currently compounding itself somewhere around 35% to 55% per month. If you don't include this nonlinear effect you are kidding yourself. The compounding difficulty factor is the dominant term that will make or break ROI.


---

