This calculator works out the full cost of swapping the collateral behind a DeFi loan — protocol fees, slippage, and gas — then shows how the swap changes your health factor and how long it takes to break even against the risk-reduction benefit.
How it works
The total cost of a collateral swap has three parts:
protocol cost = collateral value × protocol fee %
slippage cost = collateral value × slippage %
gas cost = fixed USD estimate
total cost = protocol + slippage + gas
Those costs come out of your collateral, so your post-swap collateral is the original value minus the total cost. The health factor (Aave-style) is:
health factor = collateral × liquidation threshold ÷ debt
A factor above 1 is safe; the higher the better. Because the swap consumes collateral, moving to a higher-threshold asset does not always raise the health factor — the cost can offset the gain.
Break-even
If the swap delivers a daily benefit (a lower borrow rate, or an amortised reduction in expected liquidation penalty), the break-even is:
break-even days = total cost ÷ daily benefit
Below that horizon the swap is not worth it; above it, the swap pays for itself.
Notes
Slippage and gas are estimates — confirm a live quote from your DEX aggregator and a gas oracle before you sign the transaction, especially during volatile markets. Liquidation thresholds vary by protocol and asset, so read them from the protocol’s risk parameters. All calculation runs locally in your browser; nothing is sent anywhere.