FX & Fees Engine
Interactive calculator for remittance total cost with FX spread + fee rules. Demonstrates precise money math, rounding, and deterministic outputs.
Currency.jsZod ValidationPrecise MathFee Clamping
Input Parameters
Configure your FX conversion
Calculation Formulas
effectiveRate = midRate × (1 - spread%)
pctFee = amount × pctFee%
fee = clamp(pctFee + fixed, min?, max?)
payout = round((amount - fee) × rate)
Calculation Results
Live output
Effective Rate
126.2625
(Mid: 129.5, Spread: 2.5%)
Total Fee
USD 20.00
(2.00% of amount)
Total Cost
USD 1000.00
Payout
KES 123737.25
Fee Breakdown
Fixed Fee:USD 5.00
Percentage Fee (1.5%):USD 15.00
Fee Before Clamp:USD 20.00
Min Fee Limit:USD 5.00
Max Fee Limit:USD 50.00
Total Fee:USD 20.00
Conversion Flow
Original Amount:USD 1000.00
After Fees:USD 980.00
× Effective Rate:126.2625
Rounding:half-up
Final Payout:KES 123737.25
JSON Output
json
{
"input": {
"sourceCurrency": "USD",
"targetCurrency": "KES",
"amount": 1000,
"midRate": 129.5,
"fxSpreadPercent": 2.5,
"fixedFee": 5,
"percentageFee": 1.5,
"minFee": 5,
"maxFee": 50,
"roundingMode": "half-up"
},
"output": {
"effectiveRate": 126.2625,
"percentageFeeAmount": 15,
"totalFee": 20,
"totalCost": 1000,
"payout": 123737.25,
"breakdown": {
"originalAmount": 1000,
"fxSpreadPercent": 2.5,
"midRate": 129.5,
"effectiveRate": 126.2625,
"fixedFee": 5,
"percentageFee": 1.5,
"percentageFeeAmount": 15,
"feeBeforeClamp": 20,
"totalFee": 20,
"minFee": 5,
"maxFee": 50,
"amountAfterFees": 980,
"payout": 123737.25,
"roundingMode": "half-up"
}
},
"timestamp": "2025-10-16T13:36:34.360Z",
"version": "1.0"
}
Note: This calculator uses currency.js for precision to avoid floating-point errors. All calculations are deterministic and match real-world remittance systems. Fee clamping ensures min/max limits are respected. Rounding modes affect the final payout precision.