XAUUSD Tools — free open-source gold trading calculators

Small, transparent calculators for spot gold (XAUUSD). Everything runs locally in your browser, and the code is MIT-licensed on GitHub (xauusd-calculator).

The conventions used

Most brokers quote gold to two decimals and treat a $0.10 move as 1 pip. A standard lot is 100 troy ounces, so a $0.10 move on 1 lot is worth $10. Some brokers use different contract sizes or pip definitions, so check your contract specification. If pips are new to you, this guide to how XAUUSD pip value is calculated walks through it step by step.

Pip value

Formula: pip value = lots × 100 oz × $0.10. Hypothetical example: 0.25 lots → 0.25 × 100 × 0.10 = $2.50 per pip.

Lot size from risk

Formula: lots = (balance × risk%) ÷ (stop distance in $ × 100 oz). Hypothetical example: $10,000 balance, 1% risk ($100), $5.00 stop → 100 ÷ (5 × 100) = 0.20 lots. Results round down to 0.01 lots so you never exceed your risk.

Prefer a fuller interface? Try this gold lot size calculator.

Position size from entry and stop

Same idea, but you enter prices: stop distance = |entry − stop|. Hypothetical example: entry 2,400.00, stop 2,392.00 (80 pips, $8.00), $5,000 balance at 2% ($100) → 100 ÷ 800 = 0.12 lots.

Profit / loss

Formula: P/L = (exit − entry) × lots × 100 for a buy (reversed for a sell). Hypothetical example: buy 0.50 lots at 2,400.00, exit 2,410.00 → 10 × 0.5 × 100 = $500. Spread, commission and swap are not included.

Margin

Formula: margin = lots × 100 × price ÷ leverage. Hypothetical example: 1 lot at 2,400.00 with 1:100 leverage → 240,000 ÷ 100 = $2,400. Margin is what the broker holds, not what you risk — your stop decides that. More on this in Margin vs Risk on Gold (XAUUSD).

Use it in your own code

The same functions power this page. Clone xauusdtools/xauusd-calculator and import pipValue, lotSize, positionSize, profitLoss, riskReward or margin. For a quick check without code there is also an online XAUUSD pip calculator.