DEV Community

Cover image for How I built a fast YouTube Sponsorship Calculator in Vanilla JS
NovusTools
NovusTools

Posted on • Originally published at novustools.com

How I built a fast YouTube Sponsorship Calculator in Vanilla JS

As developers running tech newsletters, blogs, or YouTube channels, getting your first sponsor is exciting—until you realize you have no idea how much to charge. I was tired of guessing my rates, so I built a clean, client-side Sponsorship Calculator.

The Approach

I built this using 100% Vanilla JS. Since audience metrics and revenue goals are private business data, I made sure there are zero server calls. Everything runs locally in your browser.

Here is a quick look at the core logic handling the CPM (Cost Per Mille) and premium placement calculations:

function calculateSponsorshipRate(averageViews, cpmRate) {
    // CPM represents the cost per 1,000 views or subscribers
    const baseRate = (averageViews / 1000) * cpmRate;

    // Add a standard 25% markup for premium/top-of-page placements
    const premiumRate = baseRate * 1.25;

    return {
        standardPrice: Math.round(baseRate),
        premiumPrice: Math.round(premiumRate)
    };
}
Enter fullscreen mode Exit fullscreen mode

Try it out

You can use the live tool for free here: Youtube Sponsorship Calculator

Let me know what you think or if you'd add any other metric variables in the comments!

Top comments (0)