<p>There's 2 parameters that affect the value of a transaction fee: the transaction's size and how long you're willing to wait for it to confirm.</p>

<p>Smaller transactions pay a smaller fee than larger transactions since miners can include more of them. At a higher level, you pay for each byte of data you want to include in a block.</p>

<p>The price per byte (denominated in satoshis per byte) that will confirm you in <em>n</em> blocks is estimated by looking at the past data (and maybe at the current transactions waiting to be confirmed).</p>

<p>Once you have that price, you can multiply the size of your transaction by it to get the fee you have to pay.</p>

<p>As for formulas, if you use standard addresses (not P2SH), the formula is:</p>

<pre><code>fee = (n_inputs * 148 + n_outputs * 34 + 10) * price_per_byte
</code></pre>

<p>SegWit slightly changes this, where instead of paying per byte, you pay per unit of weight: 1 byte of non witness data = 4 weight, 1 byte of witness data = 1 weight. </p>

CC BY-SA 3.0
2017-10-10T08:43:18.847Z
Hey Alcio,thanks for your revert but still i didn't get you actually i am bit new to blockchain API and i have say for e.g 22537 satoshi in my one of the address and i am trying to send it to new address in same wallet so for this case how the fee is calculated ??/
Chirag Daxini
CC BY-SA 3.0
2017-10-10T08:50:12.770Z
The amounts and addresses are irrelevant. What matters is the transaction complexity, i.e. how many different previous incoming payments it spends from, and how many outgoing ones it makes
Pieter Wuille
CC BY-SA 3.0
2017-10-10T09:02:53.823Z
Hi, peter thanks for your comment still i am unable to get what you're trying to explain..??
Chirag Daxini
CC BY-SA 3.0
2017-10-10T10:22:54.960Z
The fee you pay doesn't depend _at all_ on the amounts involved. Moving $100M can cost less than moving $0.01 in BTC. The only thing that matters is how large (in bytes, not value) the transaction is.
alcio
CC BY-SA 3.0
2017-10-10T08:32:24.867Z
2017-10-10T08:32:24.867Z
alcio
<p>I like to calculate the transaction fee which takes place for making the transaction to blockchain platform.</p>

<p>How can i calculate it??</p>

<p>I had gone through google and got to know that it's based on the number of blocks but still i am unable to understand it how it will be calculated.</p>

<p>So, is there any formula or process to calculate it ??</p>

<p>Thanks in advance for your revert...</p>

<transaction-fees>
Calculation of transaction fee for transaction
Chirag Daxini
# Calculation of transaction fee for transaction

(Asked by: username_0 on 2017-10-10)

I like to calculate the transaction fee which takes place for making the transaction to blockchain platform.

How can i calculate it??

I had gone through google and got to know that it's based on the number of blocks but still i am unable to understand it how it will be calculated.

So, is there any formula or process to calculate it ??

Thanks in advance for your revert...

**Tags:** transaction-fees


---

## 1 answers

### Answer by username_1 on 2017-10-10. Score: 1

There's 2 parameters that affect the value of a transaction fee: the transaction's size and how long you're willing to wait for it to confirm.

Smaller transactions pay a smaller fee than larger transactions since miners can include more of them. At a higher level, you pay for each byte of data you want to include in a block.

The price per byte (denominated in satoshis per byte) that will confirm you in *n* blocks is estimated by looking at the past data (and maybe at the current transactions waiting to be confirmed).

Once you have that price, you can multiply the size of your transaction by it to get the fee you have to pay.

As for formulas, if you use standard addresses (not P2SH), the formula is:

```
fee = (n_inputs * 148 + n_outputs * 34 + 10) * price_per_byte

```

SegWit slightly changes this, where instead of paying per byte, you pay per unit of weight: 1 byte of non witness data = 4 weight, 1 byte of witness data = 1 weight.

> **Comments:**
> **username_0**: Hey username_1,thanks for your revert but still i didn't get you actually i am bit new to blockchain API and i have say for e.g 22537 satoshi in my one of the address and i am trying to send it to new address in same wallet so for this case how the fee is calculated ??/  
> **username_2**: The amounts and addresses are irrelevant. What matters is the transaction complexity, i.e. how many different previous incoming payments it spends from, and how many outgoing ones it makes  
> **username_0**: Hi, peter thanks for your comment still i am unable to get what you're trying to explain..??  
> **username_1**: The fee you pay doesn't depend _at all_ on the amounts involved. Moving $100M can cost less than moving $0.01 in BTC. The only thing that matters is how large (in bytes, not value) the transaction is.  

---

