DEV Community

SEO - NT Tech Innovation
SEO - NT Tech Innovation

Posted on

A Tiny YouTube RPM Calculator in Python (Built for Indian Creators)

A creator friend kept asking me the same thing. "If I get 50,000 views, how much will I earn?" So I wrote a tiny script instead of guessing every time.

It's not fancy. But it uses real channel data instead of random numbers from Instagram reels.

CPM vs RPM (the part everyone mixes up)

  • CPM is what advertisers pay per 1,000 ad impressions.
  • RPM is what you earn per 1,000 views, after YouTube's share and after counting views with no ads.

RPM is the number you want. You can calculate it yourself from YouTube Studio.

The script

def rpm(revenue_inr: float, views: int) -> float:
    """Real RPM from your own Studio data."""
    if views == 0:
        return 0.0
    return revenue_inr / views * 1000


def estimate(views: int, rpm_inr: float) -> float:
    return views / 1000 * rpm_inr


# last 28 days from YouTube Studio
my_rpm = rpm(revenue_inr=4200, views=210_000)
print(f"Your RPM: ₹{my_rpm:.2f}")

for v in (10_000, 50_000, 100_000, 1_000_000):
    print(f"{v:>9,} views -> ₹{estimate(v, my_rpm):,.0f}")
Enter fullscreen mode Exit fullscreen mode

Output:

Your RPM: ₹20.00
   10,000 views -> ₹200
   50,000 views -> ₹1,000
  100,000 views -> ₹2,000
1,000,000 views -> ₹20,000
Enter fullscreen mode Exit fullscreen mode

Adding a seasonal multiplier

Ad rates in India rise in Q4 (festive season) and drop in January. A rough multiplier makes forecasts less wrong.

SEASON = {1: 0.75, 2: 0.85, 3: 0.95, 10: 1.2, 11: 1.3, 12: 1.35}

def seasonal_estimate(views, rpm_inr, month):
    return estimate(views, rpm_inr) * SEASON.get(month, 1.0)
Enter fullscreen mode Exit fullscreen mode

Tune these from your own past months. Every niche moves differently.

Where to get benchmark numbers

If you don't have your own data yet, start with published ranges by niche. This breakdown of YouTube income per 1000 views in India lists typical RPM bands and the formula behind them, which is handy for seeding the script.

Ideas to extend it

  • Read the CSV export from YouTube Studio with pandas.
  • Split Shorts and long-form RPM. They're very different.
  • Plot revenue vs views to spot outlier videos.

Small script. Saves a lot of wishful thinking.


Written by MD Fozla Rabbi, SEO Specialist.

Top comments (0)