# Pancakeswap trade fee - When is it taken ? (Liquidity pool don't show it)

I can't find how/when PancakeSwap take it 0.25% fee from trades, Nothing points to it taking any fees!

What I tried:

-Fetched my bnb balance.

-Fetched Liquidity pool of a token.

-Fetched Liquidity pool of a token again.

-Fetched my bnb balance again.

Data:

-Initial BNB balance: 0.061694940013323232

-Token address: 0xc709878167ed069aea15fd0bd4e9758ceb4da193 (Day Of Defeat 19% TAX)

-Initial LP: 4306.338723965573665600 BNB 1793846330848.225230596341489117 DOD

-After transaction LP: 4306.338733965573665600 BNB 1793846326693.044169436006428854 DOD

-Received tokens: 4155.181061160335060263 - 19% TAX = 3365.696659539871398814 DOD

Math:

LP BNB DIFF: 4306.338733965573665600 - 4306.338723965573665600 = 0.00001

LP TOKEN DIFF: 1793846330848.225230596341489117 - 1793846326693.044169436006428854 = 4155.181061160335060263

As you can see swap fee no where to be seen...

So my question is, When does PancakeSwap take it 0.25% fee from trades ?

I asked the question in Reddit and got a response.

ezmonkey

Took me some time.The fee is already included in all the transactions. When you put in 0.00001 BNB and the contract decides to give you 4155 DOD, that amount that it decides to spit out reflects the 0.25% fee. If there was no fee, the contract would have decided to give you instead 4165. This would be the case if the calculation was a simple k = tok1balance * tok2balance, but it is changed to reflect the fee.

``````// if fee is on, mint liquidity equivalent to 8/25 of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply.mul(rootK.sub(rootKLast)).mul(8);