Options Delta Hedging Calculator — Free Trading Calculator (Download, Runs in Your Browser)
- 40-options-delta-calculator/index.html — the calculator page — open this in a browser
- 40-options-delta-calculator/ui.mjs — the interface logic
- options-calculators/options.mjs — the calculation engine (options)
- shared/style.css — the styles
- README-FIRST.md — what it does and how to run it
- FREE-LICENSE.md — the free-edition license terms
About this product
Options Delta Hedging Calculator is a free trading calculator by Script Master Labs. It calculates Black-Scholes delta, your net delta including shares held, and the exact share trade that makes the position delta-neutral. It runs entirely in your browser — no server, no account, and nothing you type leaves your device — and its complete source is printed in full on this page and in the free download. No payment, no account, no subscription.
What it computes, in its own terms: delta and the delta-neutral hedge trade. Delta comes from the Black–Scholes–Merton model: for a call, delta = e^(−qT) × N(d1); for a put, e^(−qT) × (N(d1) − 1), with T in years. Position delta is contracts × multiplier × delta, signed negative for a short position; net delta adds the shares you already hold. The hedge trade is the rounded whole-share trade that brings net delta to zero, and the theoretical option price is returned as a model sanity check (the textbook inputs return the textbook $10.4506). Delta-neutral removes first-order exposure to small price moves only; gamma, vega and theta exposures remain.
How to use it
Claim the free download, unzip it, and open the index.html inside the calculator's folder in any modern browser — it runs entirely on your device, with no install, no server and no account. The full source of every file is printed on this page below, and the free download carries the same working files with a README and the free-edition license.
Free edition vs paid edition
The download is the complete calculator — the same working files sold in the paid edition (https://dual.scriptmasterlabs.com/product/options-delta-calculator, $19 one-time). The paid edition adds the full written user guide, the evidence receipt, and the licensing and security reviews. Nothing in the calculator is held back from the free edition.
More free tools — free Pine Script v6 indicators and strategies, free trading calculators and a free x402 pre-payment trust check — are collected on the Free Tools hub. Educational software, not financial advice: it computes stated formulas from your inputs; it does not predict price and shows no win rate.
The complete calculator source — free, on this page
Options Delta Hedging Calculator is a free trading calculator by Script Master Labs. It calculates Black-Scholes delta, your net delta including shares held, and the exact share trade that makes the position delta-neutral. It runs entirely in your browser — no server, no account, and nothing you type leaves your device — and its complete source is printed in full on this page and in the free download. No payment, no account, no subscription.
===== file: 40-options-delta-calculator/index.html =====
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="robots" content="noindex"><title>Options Delta Hedging Calculator | SML</title><meta name="description" content="Black-Scholes delta for a call or put position, your net delta including shares held, and the exact share trade that makes the position delta-neutral."><link rel="stylesheet" href="../shared/style.css"></head><body><main><h1>Options Delta Hedging Calculator</h1><p>Black-Scholes delta for a call or put position, your net delta including shares held, and the exact share trade that makes the position delta-neutral.</p><form id="calc"><section class="inputs"><label>Option type<select name="type"><option value="call">Call</option><option value="put">Put</option></select></label><label>Position<select name="side"><option value="long">Long</option><option value="short">Short</option></select></label><label>Contracts<input name="contracts" type="number" step="1" required></label><label>Contract multiplier (shares per contract)<input name="multiplier" type="number" step="any" value="100" required></label><label>Underlying price ($)<input name="spot" type="number" step="any" required></label><label>Strike price ($)<input name="strike" type="number" step="any" required></label><label>Days to expiry<input name="days" type="number" step="any" required></label><label>Implied volatility (%)<input name="volatilityPercent" type="number" step="any" required></label><label>Risk-free rate (%)<input name="ratePercent" type="number" step="any" value="0" required></label><label>Dividend yield (%)<input name="dividendPercent" type="number" step="any" value="0" required></label><label>Shares held (negative if short)<input name="sharesHeld" type="number" step="any" value="0" required></label></section><button>Calculate</button></form><p id="error" role="alert"></p><section id="results" hidden><h2>Results</h2><div id="metrics"></div><button id="export">Export JSON</button></section><section><h2>How this is calculated</h2><p>Delta comes from the Black-Scholes-Merton model: for a call, delta = e<sup>−qT</sup> × N(d1); for a put, delta = e<sup>−qT</sup> × (N(d1) − 1), with T in years (days ÷ 365). Position delta = contracts × multiplier × delta, signed negative for a short position. Net delta adds the shares you already hold. The hedge trade is the rounded whole-share trade that brings net delta to zero.</p><p>Limitations: this is the European Black-Scholes model — it does not model early exercise of American options. Delta is not constant: it changes as the price, time and volatility change (that is gamma), so a hedge computed now drifts and must be recomputed to stay neutral. Delta-neutral is not risk-free — vega, theta and gamma exposures remain. This calculator is not financial advice.</p></section></main><script type="module" src="ui.mjs"></script></body></html>
===== file: 40-options-delta-calculator/ui.mjs =====
import {deltaHedge} from '../options-calculators/options.mjs';const form=document.querySelector('#calc'),results=document.querySelector('#results'),metrics=document.querySelector('#metrics'),error=document.querySelector('#error');let last=null;form.addEventListener('input',()=>{last=null;results.hidden=true;error.textContent=''});form.addEventListener('submit',e=>{e.preventDefault();last=null;results.hidden=true;error.textContent='';try{const inputs=Object.fromEntries([...new FormData(form)].map(([k,v])=>[k,(k==='type'||k==='side')?v:Number(v)]));const output=deltaHedge(inputs);metrics.replaceChildren();for(const [k,v] of Object.entries(output)){const d=document.createElement('div');d.className='metric';d.textContent=k.replace(/([A-Z])/g,' $1');const s=document.createElement('strong');s.textContent=v===null?'Undefined':typeof v==='number'?v.toLocaleString('en-US',{maximumFractionDigits:4}):String(v);d.append(s);metrics.append(d)}last={inputs,output};results.hidden=false}catch(e){error.textContent=e.message}});document.querySelector('#export').onclick=()=>{if(!last)return;const url=URL.createObjectURL(new Blob([JSON.stringify(last,null,2)],{type:'application/json'}));const a=document.createElement('a');a.href=url;a.download='40-options-delta-calculator.json';a.click();URL.revokeObjectURL(url)};
===== file: options-calculators/options.mjs =====
// Shared original calculation engine for the Batch-3 options calculators
// (products 30, 31, 40). The pricing model is the published Black-Scholes-Merton
// model (1973); the normal CDF uses the Abramowitz & Stegun 26.2.17 polynomial
// approximation, the same published numerical method used by product 27's
// engine, and the two implementations are cross-checked against each other in
// options.test.mjs. Fixtures are mathematical, not market observations.
function cdf(x){const t=1/(1+0.2316419*Math.abs(x));const p=Math.exp(-x*x/2)/Math.sqrt(2*Math.PI)*t*(0.319381530+t*(-0.356563782+t*(1.781477937+t*(-1.821255978+t*1.330274429))));return x>=0?1-p:p;}
function pdf(x){return Math.exp(-x*x/2)/Math.sqrt(2*Math.PI);}
export function blackScholes({spot:S,strike:K,years:T,volatility:v,rate:r=0,dividend:q=0,type}){
if(![S,K,T,v,r,q].every(Number.isFinite)||S<=0||K<=0||T<=0||v<=0||!['call','put'].includes(type))throw new RangeError('Positive spot, strike, time and volatility required');
const a=Math.exp(-q*T),b=Math.exp(-r*T),d1=(Math.log(S/K)+(r-q+v*v/2)*T)/(v*Math.sqrt(T)),d2=d1-v*Math.sqrt(T),n=pdf(d1),call=type==='call';
const price=call?S*a*cdf(d1)-K*b*cdf(d2):K*b*cdf(-d2)-S*a*cdf(-d1);
const delta=a*(call?cdf(d1):cdf(d1)-1),gamma=a*n/(S*v*Math.sqrt(T)),vega=S*a*n*Math.sqrt(T)/100;
const theta=(-S*a*n*v/(2*Math.sqrt(T))+(call?q*S*a*cdf(d1)-r*K*b*cdf(d2):r*K*b*cdf(-d2)-q*S*a*cdf(-d1)))/365;
const rho=(call?K*T*b*cdf(d2):-K*T*b*cdf(-d2))/100;
const result={price,delta,gamma,vega,theta,rho};if(!Object.values(result).every(Number.isFinite))throw new RangeError('Model overflow');return result;
}
export function expectedMove({spot,volatilityPercent,days,straddlePrice=null}){
if(![spot,volatilityPercent,days].every(Number.isFinite)||spot<=0||volatilityPercent<=0||days<=0||(straddlePrice!==null&&(!Number.isFinite(straddlePrice)||straddlePrice<=0)))throw new RangeError('Invalid expected-move inputs');
const em=spot*(volatilityPercent/100)*Math.sqrt(days/365);
const result={ivExpectedMove:em,ivExpectedMovePercent:em/spot*100,ivLower:spot-em,ivUpper:spot+em};
if(straddlePrice!==null){const s=0.85*straddlePrice;result.straddleExpectedMove=s;result.straddleExpectedMovePercent=s/spot*100;result.straddleLower=spot-s;result.straddleUpper=spot+s;}
return result;
}
export function deltaHedge({type,side='long',contracts,multiplier=100,spot,strike,days,volatilityPercent,ratePercent=0,dividendPercent=0,sharesHeld=0}){
if(![contracts,multiplier,spot,strike,days,volatilityPercent,ratePercent,dividendPercent,sharesHeld].every(Number.isFinite)||!Number.isInteger(contracts)||contracts<=0||multiplier<=0||spot<=0||strike<=0||days<=0||volatilityPercent<=0||!['long','short'].includes(side))throw new RangeError('Invalid delta-hedge inputs');
const {delta,price}=blackScholes({spot,strike,years:days/365,volatility:volatilityPercent/100,rate:ratePercent/100,dividend:dividendPercent/100,type});
const positionDelta=(side==='long'?1:-1)*contracts*multiplier*delta;
const netDelta=positionDelta+sharesHeld;
const hedgeShares=-Math.round(netDelta);
return {optionPrice:price,deltaPerShare:delta,positionDelta,sharesHeld,netDelta,hedgeShares,hedgeAction:hedgeShares===0?'No hedge trade — already delta-neutral':hedgeShares>0?`Buy ${hedgeShares} shares`:`Sell ${-hedgeShares} shares`};
}
export function breakeven({strategy,strike,premium,contracts=1,multiplier=100,stockPrice,secondPremium,secondStrike}){
if(!Number.isInteger(contracts)||contracts<=0||!Number.isFinite(multiplier)||multiplier<=0)throw new RangeError('Invalid contracts or multiplier');
const m=contracts*multiplier,need=(ok,msg)=>{if(!ok)throw new RangeError(msg);};
const leg=()=>{need([strike,premium].every(Number.isFinite)&&strike>0&&premium>=0,'Strike and premium required');};
switch(strategy){
case 'long-call':leg();return {breakeven:strike+premium,totalPremiumPerShare:premium,maxLoss:premium*m,maxProfit:'Unlimited'};
case 'short-call':leg();return {breakeven:strike+premium,totalPremiumPerShare:premium,maxLoss:'Unlimited',maxProfit:premium*m};
case 'long-put':leg();need(strike-premium>0,'Premium exceeds strike');return {breakeven:strike-premium,totalPremiumPerShare:premium,maxLoss:premium*m,maxProfit:(strike-premium)*m};
case 'short-put':leg();need(strike-premium>0,'Premium exceeds strike');return {breakeven:strike-premium,totalPremiumPerShare:premium,maxLoss:(strike-premium)*m,maxProfit:premium*m};
case 'covered-call':leg();need(Number.isFinite(stockPrice)&&stockPrice>0,'Stock purchase price required');return {breakeven:stockPrice-premium,totalPremiumPerShare:premium,maxLoss:(stockPrice-premium)*m,maxProfit:(strike-stockPrice+premium)*m};
case 'protective-put':leg();need(Number.isFinite(stockPrice)&&stockPrice>0,'Stock purchase price required');need(stockPrice-strike+premium>0,'Strike too high for a protective put on this stock price');return {breakeven:stockPrice+premium,totalPremiumPerShare:premium,maxLoss:(stockPrice-strike+premium)*m,maxProfit:'Unlimited'};
case 'long-straddle':leg();need(Number.isFinite(secondPremium)&&secondPremium>=0,'Put premium required');{const t=premium+secondPremium;return {breakevenLow:strike-t,breakevenHigh:strike+t,totalPremiumPerShare:t,maxLoss:t*m,maxProfit:'Unlimited'};}
case 'long-strangle':leg();need(Number.isFinite(secondPremium)&&secondPremium>=0,'Put premium required');need(Number.isFinite(secondStrike)&&secondStrike>0&&secondStrike<strike,'Put strike (below the call strike) required');{const t=premium+secondPremium;return {breakevenLow:secondStrike-t,breakevenHigh:strike+t,totalPremiumPerShare:t,maxLoss:t*m,maxProfit:'Unlimited'};}
default:throw new RangeError('Unknown strategy');
}
}
===== file: shared/style.css =====
*{box-sizing:border-box}body{margin:0;background:#000;color:#fff;font:16px system-ui}main{max-width:1100px;margin:auto;padding:20px}section{border:1px solid #343434;border-radius:12px;padding:16px;margin:16px 0}h1{font-size:clamp(26px,5vw,42px)}h2{font-size:20px}label{display:grid;gap:6px}input,select,button{font:inherit;color:#fff;background:#121212;border:1px solid #777;border-radius:7px;padding:10px;min-width:0;width:100%}button{background:#123b31;cursor:pointer;width:auto;min-height:44px}button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #5eead4}.leg,.inputs,#metrics{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:12px}.leg{padding:12px 0;border-bottom:1px solid #444}.metric{padding:12px;border:1px solid #555;border-radius:8px;overflow-wrap:anywhere}.metric strong{display:block;font-size:20px;margin-top:6px}svg{width:100%;height:auto;background:#080808;margin-top:16px}#error{color:#ff9494}p{line-height:1.5}.scroll{overflow-x:auto}table{border-collapse:collapse;width:100%;margin-top:12px;font-size:14px}th,td{border:1px solid #343434;padding:8px;text-align:right;white-space:nowrap}th{background:#121212}td.pos{color:#5eead4}td.neg{color:#ff9494}td.base{background:#123b31;font-weight:700}
Questions about this product
Is there a free options delta hedging calculator I can download?
Yes. Script Master Labs publishes this Options Delta Hedging Calculator as a free download on SML Dual Market (https://dual.scriptmasterlabs.com/product/free-options-delta-calculator). The complete calculator — the same working files sold in the paid edition — is in the free download, and its full source is printed on the product page. No payment, no account, no subscription.
How do I use the Options Delta Hedging Calculator?
Claim the free download, unzip it, and open the index.html inside the calculator's folder in any modern browser. Type your numbers and press Calculate. There is nothing to install.
Does the calculator send my numbers anywhere?
No. It runs entirely in your browser on your own device: no server, no account, no feed. The numbers you type never leave your device.
Is the free edition the complete calculator?
Yes — the same working files sold in the paid edition ($19 one-time). The paid edition adds the full written user guide, the evidence receipt, and the licensing and security reviews; nothing in the calculator itself is held back.