Formula, worked examples and a calculator
CPM formula: how to calculate it, and how it differs from RPM

Short answer
CPM is spend divided by impressions, times 1,000. A $250 buy that delivers 50,000 impressions costs $5 per 1,000. A flat sponsor fee works the same way: $1,500 for a video with 42,000 views is $35.71 per 1,000 views. RPM is a different number. On YouTube it is what you earned per 1,000 views after YouTube's revenue share, so it usually comes out lower than the CPM an advertiser pays, as YouTube Help explains. Enter your two numbers in the Koldflux CPM calculator, and use the same divisor on every figure you compare.
Work out CPM from spend and impressions (free, in your browser)
Key takeaways
- CPM = spend / impressions × 1,000. Rearranged: spend = CPM × impressions / 1,000, and impressions = spend / CPM × 1,000.
- YouTube Help's own example: the same $7 is $3.50 per 1,000 ad impressions and $4.67 per 1,000 monetized playbacks. The divisor changes the answer, not the money.
- YouTube Help: "CPM is the cost per 1000 ad impressions before YouTube revenue share. RPM is your total revenue (after YouTube's revenue share) per 1000 views."
- A sponsor fee divided by views is a per-1,000-views figure, not a CPM quote, until you know whether the sponsor counts impressions or views.
- The calculator and the script matched our expected answers on all 12 inputs, including the YouTube control. For one of them, a negative spend, our first expected answer was the plain arithmetic (-5); both tools refused it, and we then decided a refusal is the right answer.
How do you calculate CPM from spend and impressions?
You have a report that says what was spent and how many times the ad was shown, and you want one number to compare with another quote. The free CPM calculator does the division in your browser, so nothing you type leaves your device. Type the spend in the first box (one currency) and the delivered impressions in the second, as a whole number: 50,000 is 50000. For 250 and 50000 the line under the boxes read "5 USD per 1,000 impressions", the tool page's own example.
Check the divisor before you trust the number. If your report counts views or video playbacks and not ad impressions, the arithmetic is still correct, but the result is a per-1,000-views figure. The tool label says "impressions" either way.
The calculator shows up to four decimal places. A figure such as 14,285.7143 for 100 over 7 is rounded for display, which matches the tool page's own note that formulas use unrounded values.

What does YouTube's own example show?
YouTube Help works one case through: a video viewed 5,000 times, 1,000 of those views with one ad and 500 with two ads. That is 1,500 monetized playbacks and 2,000 ad impressions, and the advertiser paid $7 in total.
YouTube states two answers from that $7: a CPM of $3.50 per 1,000 impressions and a playback-based CPM of $4.67. The Koldflux calculator, given 7 over 2,000 and 7 over 1,500, showed 3.5 and 4.6667, so it reproduces both. The third row is our own arithmetic on the same $7 and is not a YouTube metric.
| Divisor | Count | Result per 1,000 | Who states it |
|---|---|---|---|
| Ad impressions | 2,000 | 3.50 | YouTube Help: CPM |
| Monetized playbacks | 1,500 | 4.67 | YouTube Help: playback-based CPM |
| All views | 5,000 | 1.40 | Our arithmetic, not a YouTube metric |
The money did not change in any row. The count under it did. When two quotes disagree, ask which of those three counts sits under each one before you decide one is cheaper.
How is RPM different from CPM?
YouTube Help puts it in one pair of sentences: "CPM is the cost per 1000 ad impressions before YouTube revenue share. RPM is your total revenue (after YouTube's revenue share) per 1000 views."
CPM is the advertiser's number
It counts only ads and YouTube Premium revenue, only the views that showed an ad, and the money before YouTube's share.
RPM is the creator's number
The page says RPM is "calculated after YouTube's revenue share" and "includes all views, including ones that weren’t monetized". It counts more kinds of income too: ads, YouTube Premium, channel memberships, Super Chat and Super Stickers.
| CPM | RPM | |
|---|---|---|
| Whose view | Advertiser-focused | Creator-focused |
| Money counted | Ads and YouTube Premium | Total revenue in YouTube Analytics |
| Views counted | Only monetized views | All views (Shorts: all engaged views) |
| Revenue share | Before it | After it |
So, in our reading, you cannot turn a CPM into an RPM with a formula. The pieces that sit between them, the share and the unmonetized views, are not in the CPM. Read RPM from YouTube Analytics. If you hold total revenue and the number of views for one video over the same period, revenue divided by views, times 1,000, is the same arithmetic, but the figure YouTube displays is the one its definition applies to.
How do you turn a flat sponsor fee into a CPM?
A brand offers a fixed amount for a video. Divide the fee by the views or impressions the video delivers, then multiply by 1,000, and the offer becomes a per-1,000 number you can set beside an ad quote. Three made-up offers, run through the script below and agreeing with the calculator:
| Offer | Fee | Views delivered | Per 1,000 views |
|---|---|---|---|
| Video A | 1,500 | 42,000 | 35.7143 |
| Video B | 600 | 30,000 | 20 |
| Video C | 250 | 50,000 | 5 |
These figures are examples, not market rates, and this page does not say what a CPM should be. None of the sources read gives a typical figure, and a number from one channel does not carry over to another. The table only shows how a fee and a view count combine.
One catch: a sponsor who quotes a CPM counts what its own report counts, often impressions. A per-views figure and a per-impressions quote are not the same base, as the $7 table above showed with 3.50 against 1.40.
How do you go from a target CPM to a fee or a budget?
Rearrange the same formula. The script printed 600.0000 and 30000.0000 for these two cases.
- A brand has agreed a CPM of 20 and expects 30,000 impressions: it pays 20 × 30,000 / 1,000 = 600.
- A brand has a budget of 600 at a CPM of 20: it buys 600 / 20 × 1,000 = 30,000 impressions.
Say in the contract which count the CPM is applied to. The arithmetic is the easy part.
Can a script do it for a whole list of offers?
Yes. The Python script uses only the standard library. Put one offer per line in a UTF-8 CSV with exactly three comma-separated columns: a label, the spend and the impressions. Write amounts as plain numbers; a header line is allowed only when its spend and impressions cells contain no digit. Run the first command. The other three do a single calculation each.
On the three offers above it printed 35.7143, 20.0000 and 5.0000. It was also run on a file with Windows line breaks and a non-ASCII label (35.7143). These each stopped with a one-line message and exit code 1: an empty file, a missing file, a directory instead of a file, a row with 0 impressions, a row with text in the spend cell, a row with semicolons or with more than three columns, 0 impressions, a negative number in any of the four commands, and text typed instead of a number. A thousands separator such as 1,500 is accepted on the command line; in a CSV file write 1500 or put "1,500" in quotes, because an unquoted 1,500 is two columns and is refused. A comma is read only as a thousands separator, so 12,5 is refused: write decimals with a dot. The script needs Python 3 and the standard library only; on Windows the command may be py instead of python3. Unlike the calculator, it does not require whole impressions.
The script and a sample deals.csv are linked under Sources. The commands log lists every command above with its exit code and an edge input.
python3 cpm.py file deals.csvpython3 cpm.py cpm 1500 42000
python3 cpm.py spend 20 30000
python3 cpm.py impressions 600 20What does the calculator do with odd input?
Twelve inputs were written down before any tool ran. Eleven had their expected answers written first, two of them "no number" (zero impressions, an empty field). For the twelfth, a negative spend, the first expected answer was the plain arithmetic, -5; the calculator and the script both refused it, and we then changed the expected answer to a refusal and re-ran the comparison. So the calculator and the script matched the answers written first on 11 inputs, and on the twelfth they agree with each other and with the answer we settled on afterwards. The calculator also refuses fractional impressions; the script does not check for them.
- 250 spend, 0 impressions: "CPM is undefined with zero impressions."
- −5 spend, 1,000 impressions: "Spend: enter a number from 0 to 1000000000000."
- 250 spend, empty impressions: "Delivered impressions: enter a whole number from 0 to 1000000000000000."
- 100 spend, 7 impressions: "14,285.7143 USD per 1,000 impressions", the repeating decimal rounded for display.
The expected answers came from a separate Python script (Decimal arithmetic), so the calculator was checked against something other than itself. Controls with a known answer were 250 over 50,000 (5), 1 over 1,000 (1) and the two YouTube Help figures.
Where this stops: what we did not verify
One YouTube Help page, one calculator and one script are all this rests on. The script was run only on the inputs in the commands log, with Python 3.12.3. No channel, ad account or sponsor was used, every spend, view and fee figure is made up, and nothing here says what a campaign or channel would earn. The YouTube page was read on November 24, 2026 in a headless browser with its collapsed answers opened, and Help pages change.
Other platforms define their own metrics. This page quotes only YouTube's definitions of CPM and RPM and does not describe how TikTok, Instagram or any ad network counts impressions. The calculator's label reads "impressions" even when you type views, and it does not check where your numbers come from.
Do it in your browser
Free Koldflux tools, no account needed.
Work out CPM from spend and impressions (free, in your browser)YouTube earnings calculator: views, RPM and goal
Questions people ask
What is the CPM formula?
CPM = spend / impressions × 1,000. For 250 spent and 50,000 impressions that is 250 / 50,000 × 1,000 = 5 per 1,000 impressions.
What does CPM stand for?
YouTube Help writes it as "Cost per 1,000 impressions (CPM)": the amount an advertiser pays for every 1,000 times an ad is shown.
How do I calculate cost from CPM?
Multiply the CPM by the impressions and divide by 1,000. At a CPM of 20 and 30,000 impressions the cost is 600.
Why is my RPM lower than my CPM on YouTube?
YouTube Help gives two reasons: RPM is calculated after YouTube's revenue share, and it includes all views, including ones that weren't monetized.
Can I use views instead of impressions in the formula?
The arithmetic is the same, and the result is a figure per 1,000 views. Do not compare it with a CPM quote that counts impressions: for YouTube's $7 example those two bases gave 1.40 and 3.50.
What is a good CPM?
This page gives no figure. None of the sources read states a typical CPM, and one made-up example does not carry over to your channel or audience.
Related
More guides on this topic
Sources and how we checked
- YouTube Help: Understand ad revenue analytics, RPM and CPM (official, read November 24, 2026, collapsed answers opened) (checked 2026-11-24)
- Koldflux CPM calculator (Koldflux tool, run November 24, 2026) (checked 2026-11-24)
- Koldflux test log: 12 inputs, expected answers, calculator and script (Koldflux measurement, November 24, 2026) (checked 2026-11-24)
- Commands log: the published commands, the commands as run, exit codes and edge cases (Koldflux) (checked 2026-11-24)
- cpm.py: CPM, spend and impressions arithmetic (Koldflux, Python 3 script) (checked 2026-11-24)
- deals.csv: the three example offers (Koldflux) (checked 2026-11-24)
- expected.py: writes the expected answers first (Koldflux, Python 3 script) (checked 2026-11-24)
- tool-run.cjs: drives the CPM calculator in Chromium (Koldflux, Node.js with Playwright) (checked 2026-11-24)
- analyze.py: compares expected answers, calculator and script (Koldflux, Python 3 script) (checked 2026-11-24)
- cases.json: the 12 test inputs (Koldflux) (checked 2026-11-24)
On November 24, 2026 the YouTube Help page on RPM and CPM was opened in headless Chromium, its collapsed answers were expanded and the sentences above were quoted from the saved text. Twelve inputs were written with their expected CPM first (Python Decimal), then entered into the live Koldflux CPM calculator in Chromium and into the published Python script: both matched on 11 of 12 against answers written first; on the twelfth (negative spend) both refused the number, where our first expected answer had been the plain arithmetic, -5, which we then replaced with a refusal. Controls: 250 over 50,000 gives 5, 1 over 1,000 gives 1, and YouTube Help's $7 example gives 3.50 and 4.67 (the calculator showed 3.5 and 4.6667). Two inputs were built to give no number (zero impressions, an empty field) and each did; negative spend was added to that group after the run. The script was later tightened after an independent check (negative numbers refused in all four commands, strict CSV columns, a comma read only as a thousands separator) and its edge cases are in the commands log. All spend, view and fee figures are made up. No ad account, channel or sponsor was used.