import gradio as gr import math # Equity Dilution Calculator def calculate_equity_dilution(pre_money_valuation, investment_amount, current_ownership): if not all([pre_money_valuation, investment_amount, current_ownership]) or any(x <= 0 for x in [pre_money_valuation, investment_amount, current_ownership]): return "Please enter valid positive values" if current_ownership > 100: return "Current ownership cannot exceed 100%" post_money_valuation = pre_money_valuation + investment_amount dilution_factor = pre_money_valuation / post_money_valuation new_ownership = (current_ownership / 100) * dilution_factor * 100 dilution_percentage = current_ownership - new_ownership investor_ownership = (investment_amount / post_money_valuation) * 100 return f""" 💰 EQUITY DILUTION RESULTS 📊 Pre-money Valuation: ${pre_money_valuation:,.0f} 💵 Investment Amount: ${investment_amount:,.0f} 📈 Post-money Valuation: ${post_money_valuation:,.0f} 👥 Ownership Changes: • Your ownership before: {current_ownership:.2f}% • Your ownership after: {new_ownership:.2f}% • Dilution: {dilution_percentage:.2f}% • Investor ownership: {investor_ownership:.2f}% 📝 Key Insights: • You retain {new_ownership:.1f}% of the company • Investor gets {investor_ownership:.1f}% for ${investment_amount:,.0f} • Your stake is diluted by {dilution_percentage:.1f} percentage points """ # Runway Calculator def calculate_runway(current_cash, monthly_burn, monthly_revenue=0): if not all([current_cash, monthly_burn]) or current_cash <= 0 or monthly_burn <= 0: return "Please enter valid positive values for cash and burn rate" net_burn = monthly_burn - monthly_revenue if net_burn <= 0: return f""" 🎉 CONGRATULATIONS! YOU'RE PROFITABLE 💰 Current Cash: ${current_cash:,.0f} 📈 Monthly Revenue: ${monthly_revenue:,.0f} 💸 Monthly Burn: ${monthly_burn:,.0f} 💚 Net Cash Flow: +${abs(net_burn):,.0f}/month 🚀 You're generating positive cash flow! Your business is sustainable and growing. """ runway_months = current_cash / net_burn runway_days = runway_months * 30 # Calculate when cash runs out import datetime today = datetime.date.today() cash_out_date = today + datetime.timedelta(days=runway_days) # Runway status if runway_months < 3: status = "🔴 CRITICAL" advice = "Immediate action required! Consider emergency fundraising or cost cuts." elif runway_months < 6: status = "🟡 WARNING" advice = "Start fundraising now. Typical fundraising takes 3-6 months." elif runway_months < 12: status = "🟢 HEALTHY" advice = "Good runway. Plan your next fundraising round." else: status = "💚 EXCELLENT" advice = "Strong position. Focus on growth and product development." return f""" ⏰ RUNWAY CALCULATION 💰 Current Cash: ${current_cash:,.0f} 📈 Monthly Revenue: ${monthly_revenue:,.0f} 💸 Monthly Burn: ${monthly_burn:,.0f} 📉 Net Burn: ${net_burn:,.0f}/month 🎯 Runway Results: • Runway: {runway_months:.1f} months ({runway_days:.0f} days) • Cash depletes on: {cash_out_date.strftime('%B %d, %Y')} • Status: {status} 💡 Recommendation: {advice} 📊 Burn Rate Optimization: • To extend runway to 12 months: Reduce burn to ${current_cash/12:,.0f}/month • To extend runway to 18 months: Reduce burn to ${current_cash/18:,.0f}/month """ # Startup Valuation Calculator (Berkus Method) def calculate_berkus_valuation(idea_score, prototype_score, team_score, market_score, revenue_score): if not all(isinstance(x, (int, float)) and 0 <= x <= 5 for x in [idea_score, prototype_score, team_score, market_score, revenue_score]): return "Please rate all factors from 0 to 5" # Berkus Method scoring factors = { "Sound Idea": idea_score, "Prototype": prototype_score, "Quality Management Team": team_score, "Strategic Relationships": market_score, "Product Rollout/Sales": revenue_score } # Each factor can add up to $500K in valuation max_per_factor = 500000 total_valuation = sum(score * max_per_factor for score in factors.values()) # Calculate weighted score total_score = sum(factors.values()) avg_score = total_score / 5 # Risk assessment if avg_score >= 4: risk_level = "🟢 LOW RISK" investment_advice = "Strong investment candidate" elif avg_score >= 3: risk_level = "🟡 MEDIUM RISK" investment_advice = "Promising with some concerns" elif avg_score >= 2: risk_level = "🟠 HIGH RISK" investment_advice = "Significant risks present" else: risk_level = "🔴 VERY HIGH RISK" investment_advice = "Major concerns across multiple areas" breakdown = "\n".join([f"• {factor}: {score}/5 → ${score * max_per_factor:,.0f}" for factor, score in factors.items()]) return f""" 📊 BERKUS METHOD VALUATION {breakdown} 💰 Total Valuation: ${total_valuation:,.0f} 📈 Average Score: {avg_score:.1f}/5 ⚠️ Risk Level: {risk_level} 💡 Investment Advice: {investment_advice} 📋 Valuation Breakdown: • Maximum possible: $2,500,000 (5/5 on all factors) • Your valuation: ${total_valuation:,.0f} ({total_score}/25 points) • Percentile: {(total_valuation/2500000)*100:.1f}% of maximum 📝 Note: Berkus Method is ideal for pre-revenue startups. Consider other methods (DCF, Market Multiple) for revenue-generating companies. """ # Investment Return Calculator def calculate_investment_returns(investment_amount, exit_valuation, ownership_percentage, years_to_exit): if not all([investment_amount, exit_valuation, ownership_percentage, years_to_exit]) or any(x <= 0 for x in [investment_amount, exit_valuation, ownership_percentage, years_to_exit]): return "Please enter valid positive values" if ownership_percentage > 100: return "Ownership percentage cannot exceed 100%" exit_value = (ownership_percentage / 100) * exit_valuation total_return = exit_value - investment_amount roi_percentage = (total_return / investment_amount) * 100 multiple = exit_value / investment_amount # Calculate IRR (Internal Rate of Return) irr = ((exit_value / investment_amount) ** (1/years_to_exit) - 1) * 100 # Performance assessment if multiple >= 10: performance = "🚀 EXCEPTIONAL" grade = "A+" elif multiple >= 5: performance = "💎 EXCELLENT" grade = "A" elif multiple >= 3: performance = "🎯 GOOD" grade = "B+" elif multiple >= 2: performance = "✅ ACCEPTABLE" grade = "B" else: performance = "⚠️ BELOW EXPECTATIONS" grade = "C" return f""" 💰 INVESTMENT RETURN ANALYSIS 📊 Investment Details: • Initial Investment: ${investment_amount:,.0f} • Exit Valuation: ${exit_valuation:,.0f} • Your Ownership: {ownership_percentage:.2f}% • Time to Exit: {years_to_exit} years 🎯 Return Metrics: • Exit Value: ${exit_value:,.0f} • Total Return: ${total_return:,.0f} • ROI: {roi_percentage:.1f}% • Multiple: {multiple:.1f}x • IRR: {irr:.1f}% per year 📈 Performance: {performance} (Grade: {grade}) 📊 Benchmarks: • Top-tier VC target: 10x+ multiple, 25%+ IRR • Good VC return: 3-10x multiple, 15-25% IRR • Acceptable return: 2-3x multiple, 10-15% IRR 💡 Analysis: {"This exceeds top-tier VC expectations!" if multiple >= 10 else "Strong return meeting VC expectations." if multiple >= 3 else "Below typical VC return expectations." if multiple >= 2 else "Consider if this investment aligns with your risk tolerance."} """ # Cap Table Calculator def calculate_cap_table(founders_shares, employee_pool_percent, series_a_investment, series_a_pre_money): if not all([founders_shares, employee_pool_percent, series_a_investment, series_a_pre_money]): return "Please fill in all fields" if founders_shares <= 0 or employee_pool_percent < 0 or employee_pool_percent > 50: return "Please enter valid values (employee pool should be 0-50%)" if series_a_investment <= 0 or series_a_pre_money <= 0: return "Please enter positive values for investment and pre-money valuation" # Calculate pre-Series A cap table employee_shares = (employee_pool_percent / 100) * founders_shares / (1 - employee_pool_percent / 100) pre_series_a_shares = founders_shares + employee_shares # Calculate Series A post_money_valuation = series_a_pre_money + series_a_investment series_a_price_per_share = series_a_pre_money / pre_series_a_shares series_a_shares = series_a_investment / series_a_price_per_share # Post-Series A ownership total_shares = pre_series_a_shares + series_a_shares founders_ownership = (founders_shares / total_shares) * 100 employee_ownership = (employee_shares / total_shares) * 100 investor_ownership = (series_a_shares / total_shares) * 100 # Dilution calculation founders_dilution = 100 - founders_ownership - employee_ownership return f""" 📊 CAP TABLE ANALYSIS 🏢 Pre-Series A Structure: • Founders: {founders_shares:,.0f} shares • Employee Pool: {employee_shares:,.0f} shares ({employee_pool_percent}%) • Total Pre-Series A: {pre_series_a_shares:,.0f} shares 💰 Series A Details: • Investment: ${series_a_investment:,.0f} • Pre-money Valuation: ${series_a_pre_money:,.0f} • Post-money Valuation: ${post_money_valuation:,.0f} • Price per Share: ${series_a_price_per_share:.2f} • New Shares Issued: {series_a_shares:,.0f} 👥 Post-Series A Ownership: • Founders: {founders_ownership:.1f}% ({founders_shares:,.0f} shares) • Employee Pool: {employee_ownership:.1f}% ({employee_shares:,.0f} shares) • Series A Investors: {investor_ownership:.1f}% ({series_a_shares:,.0f} shares) • Total Shares: {total_shares:,.0f} 📉 Dilution Impact: • Founders diluted by: {founders_dilution:.1f} percentage points • Founders retain: {founders_ownership:.1f}% ownership 💡 Key Insights: • Each founder share is now worth ${series_a_price_per_share:.2f} • Total founder equity value: ${(founders_shares * series_a_price_per_share):,.0f} • Employee pool value: ${(employee_shares * series_a_price_per_share):,.0f} """ # Create Gradio Interface with gr.Blocks( title="Startup Calculator - Essential Tools for Founders, VCs & Investors", theme=gr.themes.Soft(), css=""" .main-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 30px; border-radius: 15px; text-align: center; margin-bottom: 20px; } .feature-card { background: rgba(102, 126, 234, 0.1); border-left: 4px solid #667eea; padding: 15px; margin: 10px 0; border-radius: 8px; } .step-box { background: rgba(255, 255, 255, 0.8); border-radius: 8px; padding: 15px; margin: 10px 0; border-left: 4px solid #667eea; } .footer { text-align: center; padding: 20px; color: #666; border-top: 1px solid #eee; margin-top: 30px; } /* Dark theme support */ .dark .main-header { background: linear-gradient(135deg, #4a5568 0%, #2d3748 100%); } .dark .feature-card { background: rgba(74, 85, 104, 0.3); border-left-color: #90cdf4; color: #e2e8f0; } .dark .step-box { background: rgba(45, 55, 72, 0.8); border-left-color: #90cdf4; color: #e2e8f0; } .dark .footer { color: #a0aec0; border-top-color: #4a5568; } """ ) as app: with gr.Column(): gr.HTML("""

🚀 Startup Calculator

Essential financial tools for founders, VCs, and investors

""") with gr.Tabs(): with gr.Tab("📖 Overview"): gr.HTML("""

🎯 Why Use This Calculator?

⚡ Save Time:

No more complex spreadsheets or manual calculations

✅ Avoid Errors:

Automated formulas based on industry standards

📊 Make Better Decisions:

Get instant insights for fundraising and investment decisions

🆓 Free & Accessible:

Use anytime, anywhere, no signup required

🛠️ Available Tools

💰 Equity Dilution

Calculate ownership changes after funding rounds

⏰ Runway Calculator

Track cash runway and burn rate optimization

📊 Startup Valuation

Estimate company value using Berkus Method

📈 Investment Returns

Calculate ROI, IRR, and investment multiples

📋 Cap Table

Model ownership structure and dilution

""") with gr.Tab("💰 Equity Dilution"): with gr.Row(): with gr.Column(): pre_money = gr.Number( label="Pre-money Valuation ($)", info="Company value before investment" ) investment = gr.Number( label="Investment Amount ($)", info="Amount being invested" ) current_ownership = gr.Number( label="Current Ownership (%)", info="Your current ownership percentage" ) dilution_btn = gr.Button("Calculate Dilution", variant="primary") with gr.Column(): dilution_result = gr.Markdown(label="Results") dilution_btn.click( fn=calculate_equity_dilution, inputs=[pre_money, investment, current_ownership], outputs=dilution_result ) with gr.Tab("⏰ Runway Calculator"): with gr.Row(): with gr.Column(): current_cash = gr.Number( label="Current Cash ($)", info="Cash in bank account" ) monthly_burn = gr.Number( label="Monthly Burn Rate ($)", info="Monthly expenses/spending" ) monthly_revenue = gr.Number( label="Monthly Revenue ($)", info="Monthly recurring revenue (optional)", value=0 ) runway_btn = gr.Button("Calculate Runway", variant="primary") with gr.Column(): runway_result = gr.Markdown(label="Results") runway_btn.click( fn=calculate_runway, inputs=[current_cash, monthly_burn, monthly_revenue], outputs=runway_result ) with gr.Tab("📊 Startup Valuation"): with gr.Row(): with gr.Column(): gr.Markdown("### Rate each factor from 0-5:") idea_score = gr.Slider( minimum=0, maximum=5, step=0.5, value=3, label="Sound Idea (0-5)", info="Quality and uniqueness of the business idea" ) prototype_score = gr.Slider( minimum=0, maximum=5, step=0.5, value=3, label="Prototype/Product (0-5)", info="Development stage and product quality" ) team_score = gr.Slider( minimum=0, maximum=5, step=0.5, value=3, label="Management Team (0-5)", info="Experience and track record of founders" ) market_score = gr.Slider( minimum=0, maximum=5, step=0.5, value=3, label="Strategic Relationships (0-5)", info="Market connections and partnerships" ) revenue_score = gr.Slider( minimum=0, maximum=5, step=0.5, value=3, label="Product Rollout/Sales (0-5)", info="Revenue generation and market traction" ) valuation_btn = gr.Button("Calculate Valuation", variant="primary") with gr.Column(): valuation_result = gr.Markdown(label="Results") valuation_btn.click( fn=calculate_berkus_valuation, inputs=[idea_score, prototype_score, team_score, market_score, revenue_score], outputs=valuation_result ) with gr.Tab("📈 Investment Returns"): with gr.Row(): with gr.Column(): investment_amt = gr.Number( label="Investment Amount ($)", info="Initial investment" ) exit_val = gr.Number( label="Exit Valuation ($)", info="Expected company value at exit" ) ownership_pct = gr.Number( label="Ownership Percentage (%)", info="Your ownership stake" ) years_exit = gr.Number( label="Years to Exit", info="Expected time to exit event" ) returns_btn = gr.Button("Calculate Returns", variant="primary") with gr.Column(): returns_result = gr.Markdown(label="Results") returns_btn.click( fn=calculate_investment_returns, inputs=[investment_amt, exit_val, ownership_pct, years_exit], outputs=returns_result ) with gr.Tab("📋 Cap Table"): with gr.Row(): with gr.Column(): founders_shares = gr.Number( label="Founders' Shares", info="Number of shares held by founders" ) employee_pool = gr.Number( label="Employee Pool (%)", info="Percentage reserved for employees (typically 10-20%)" ) series_a_inv = gr.Number( label="Series A Investment ($)", info="Amount being raised in Series A" ) series_a_pre = gr.Number( label="Series A Pre-money ($)", info="Pre-money valuation for Series A" ) captable_btn = gr.Button("Calculate Cap Table", variant="primary") with gr.Column(): captable_result = gr.Markdown(label="Results") captable_btn.click( fn=calculate_cap_table, inputs=[founders_shares, employee_pool, series_a_inv, series_a_pre], outputs=captable_result ) with gr.Tab("📖 How to Use"): gr.HTML("""

📋 Quick Start Guide

Step 1: Choose Your Tool

Select the calculator that matches your needs from the tabs above

Step 2: Enter Your Data

Fill in the required fields with your startup's financial information

Step 3: Get Results

Click the calculate button to see detailed analysis and insights

Step 4: Make Decisions

Use the insights to make informed business and investment decisions

❓ Frequently Asked Questions

Are the calculations accurate?

Yes, all calculations use industry-standard formulas and methods commonly used by VCs and startup professionals.

Do I need to create an account?

No, all tools are completely free and require no registration or signup.

Is my data stored or shared?

No, all calculations are performed locally and no data is stored or shared.

Which valuation method should I use?

The Berkus Method is ideal for pre-revenue startups. For revenue-generating companies, consider DCF or market multiple approaches.

What's a good runway length?

Generally, 12-18 months is considered healthy. Less than 6 months requires immediate attention.

""") gr.HTML(""" """) if __name__ == "__main__": app.launch(server_name="0.0.0.0", server_port=7860)