Embed a Calculator on Your Site
Any calculator on this site can go on your own web page, free as long as a credit to MeanCalculator.com stays visible, with no account and no tracking. Copy the code from the calculator’s Embed panel, or customise it in the demo first.
Want to see it first? Try the options live.
Quick start
- Open the calculator you want, for example the weighted mean calculator.
- Press Embed, beside Share under the field.
- To start it with your own numbers, tick Start with the numbers I have entered.
- Press Copy code. To choose the steps, the parts to show, the theme or the credit first, press Customise this calculator: the demo opens on that calculator, and its code is the one to copy.
- Paste the code into the HTML of your page, where the calculator should appear. In a site builder, use its HTML or embed block.
Every option is in the embed demo, where you see the real embed change as you choose.
Terms of use
Free to use, with a credit to MeanCalculator.com kept visible. The code comes with two: the link to MeanCalculator.com under the frame (you may add rel="nofollow" to it) and the credit inside the calculator. You may remove either one, not both: if you hide the credit inside with credit=off, the link under the frame must stay. Do not hide, cover or crop the credit you keep, and do not present the calculator as your own.
The link is the line under the frame, the second line of the code: for the weighted mean
calculator, “Weighted mean calculator by MeanCalculator.com”. The credit is the line at the foot of the calculator,
“Full calculator on MeanCalculator.com ↗”, a link to the full calculator that opens in a new tab. The code has both. You may delete the
line under the frame and keep the credit, or hide the credit and keep the link: untick “Show the credit inside the calculator” under
Credit in the demo, which adds credit=off to the end of the frame’s address.
What the code contains
The code for the weighted mean calculator, with no options chosen:
<iframe src="https://meancalculator.com/embed/weighted-mean.html" title="Weighted Mean Calculator" width="100%" height="720" style="border:0;width:100%;max-width:100%" loading="lazy" allow="clipboard-write" data-meancalculator></iframe>
<p>Weighted mean calculator by <a href="https://meancalculator.com/weighted-mean.html">MeanCalculator.com</a></p>
<script>addEventListener('message',function(e){if(e.origin!=="https://meancalculator.com"||!e.data||e.data.type!=="meancalculator:height")return;var h=e.data.height;if(typeof h!=='number'||!isFinite(h))return;h=Math.min(6000,Math.max(200,Math.ceil(h)));var f=document.querySelectorAll('iframe[data-meancalculator]');for(var i=0;i<f.length;i++)if(f[i].contentWindow===e.source)f[i].style.height=h+'px';});</script>
- The frame: the calculator itself.
- The link under the frame: keep it, or the credit inside the calculator, visible (see Terms of use).
- The resize script: fits the frame’s height to the calculator; optional.
Line by line, for your IT team
- 1. The frame
-
The calculator itself, from
https://meancalculator.com/embed/weighted-mean.html. Itstitlenames the calculator for screen readers.loading="lazy"loads it only when a visitor scrolls near it. It fills the width of its column, starts 720px high and has no border.allow="clipboard-write"lets the calculator’s copy buttons work inside the frame.data-meancalculatormarks it for the resize script. At the foot of the calculator is its own credit, “Full calculator on MeanCalculator.com ↗”;credit=offat the end of the address hides it, for a page that keeps the link under the frame. - 2. The link under the frame
-
A line under the frame, “Weighted mean calculator by MeanCalculator.com”, with MeanCalculator.com linking to the full calculator. It
is part of the condition of use: you may remove it while the credit inside the calculator
shows, but with
credit=offit must stay on your page, visible, with the calculator. You may addrel="nofollow"to its link. - 3. The resize script
-
A few lines of JavaScript that set the frame’s height to fit the calculator, and change it when the
calculator grows or shrinks, for example when a visitor opens the steps. It reads only messages from
https://meancalculator.com, only for the frames on your page markeddata-meancalculator, and only a height, which it keeps between 200 and 6000px. It loads nothing and changes nothing else on your page. Pasting it more than once, with several calculators on a page, does no harm. Without it the frame stays 720px high and the calculator scrolls inside it.
Options
The embed demo sets every option for you: the numbers to start with, the calculator’s settings, the parts to show, the theme and the credit. It writes them into the frame’s address in the code.
Every option, for writing the address by hand
The options come after ? in the frame’s address, as name=value, separated by
&. In the code, & is written & and a comma may be written
%2C; both mean the same. An option a calculator does not use, or a value it does not accept, is ignored.
Starting numbers
In the Embed panel: Start with the numbers I have entered (on the GPA calculator, Start with the grades I have entered). Without them, the calculator starts with its own worked example.
Calculator settings
With the starting numbers, the Embed panel also writes the settings chosen on the calculator’s page, such as Decimals.
What to show
In the demo: Steps (Shown, Start closed, Hidden) and a box for each part the calculator has (Show the chart, Show the other figures, Show the examples, Show the values used, Show the Decimals setting). The headline result always shows.
Theme
In the demo: Theme (Follow the device, Light, Dark).
Credit
In the demo: Show the credit inside the calculator, under Credit.
| Full page | Embed address | Parts it has |
|---|---|---|
| Mean Calculator | https://meancalculator.com/embed/mean.html |
steps, chart, other figures, values used, Decimals setting |
| Median Calculator | https://meancalculator.com/embed/median.html |
steps, chart, other figures, values used, Decimals setting |
| Standard Deviation Calculator | https://meancalculator.com/embed/standard-deviation.html |
steps, chart, other figures, values used, Decimals setting |
| Weighted Mean Calculator | https://meancalculator.com/embed/weighted-mean.html |
steps, chart, other figures, examples, values used, Decimals setting |
| Geometric Mean Calculator | https://meancalculator.com/embed/geometric-mean.html |
steps, chart, other figures, values used, Decimals setting |
| Harmonic Mean Calculator | https://meancalculator.com/embed/harmonic-mean.html |
steps, chart, other figures, values used, Decimals setting |
| Descriptive Statistics Calculator | https://meancalculator.com/embed/statistics.html |
steps, chart, other figures, examples, values used, Decimals setting |
| GPA Calculator | https://meancalculator.com/embed/gpa.html |
steps, other figures, Decimals setting |
Examples
Each code is complete: copy it as it is, or change the numbers in its address.
A weighted mean of a fixed set of grades
Coursework 78 counts 20%, a project 85 counts 30% and the exam 92 counts 50%. The steps start closed, for students to try first.
Code
<iframe src="https://meancalculator.com/embed/weighted-mean.html?x=78%2C85%2C92&w=20%2C30%2C50&steps=closed" title="Weighted Mean Calculator" width="100%" height="720" style="border:0;width:100%;max-width:100%" loading="lazy" allow="clipboard-write" data-meancalculator></iframe>
<p>Weighted mean calculator by <a href="https://meancalculator.com/weighted-mean.html">MeanCalculator.com</a></p>
<script>addEventListener('message',function(e){if(e.origin!=="https://meancalculator.com"||!e.data||e.data.type!=="meancalculator:height")return;var h=e.data.height;if(typeof h!=='number'||!isFinite(h))return;h=Math.min(6000,Math.max(200,Math.ceil(h)));var f=document.querySelectorAll('iframe[data-meancalculator]');for(var i=0;i<f.length;i++)if(f[i].contentWindow===e.source)f[i].style.height=h+'px';});</script>
An exercise: the answer, not the steps
Students check the mean of their own numbers; the steps and the other figures are left out.
Code
<iframe src="https://meancalculator.com/embed/mean.html?x=12%2C15%2C9%2C20%2C14&steps=off&figures=off" title="Mean Calculator" width="100%" height="720" style="border:0;width:100%;max-width:100%" loading="lazy" allow="clipboard-write" data-meancalculator></iframe>
<p>Mean calculator by <a href="https://meancalculator.com/">MeanCalculator.com</a></p>
<script>addEventListener('message',function(e){if(e.origin!=="https://meancalculator.com"||!e.data||e.data.type!=="meancalculator:height")return;var h=e.data.height;if(typeof h!=='number'||!isFinite(h))return;h=Math.min(6000,Math.max(200,Math.ceil(h)));var f=document.querySelectorAll('iframe[data-meancalculator]');for(var i=0;i<f.length;i++)if(f[i].contentWindow===e.source)f[i].style.height=h+'px';});</script>
A GPA calculator started with courses
Four courses with their grades and credits, in light colours on any device.
Code
<iframe src="https://meancalculator.com/embed/gpa.html?x=A%2CB%2B%2CA-%2CB&w=3%2C4%2C4%2C3&steps=closed&theme=light" title="GPA Calculator" width="100%" height="720" style="border:0;width:100%;max-width:100%" loading="lazy" allow="clipboard-write" data-meancalculator></iframe>
<p>GPA calculator by <a href="https://meancalculator.com/gpa-calculator.html">MeanCalculator.com</a></p>
<script>addEventListener('message',function(e){if(e.origin!=="https://meancalculator.com"||!e.data||e.data.type!=="meancalculator:height")return;var h=e.data.height;if(typeof h!=='number'||!isFinite(h))return;h=Math.min(6000,Math.max(200,Math.ceil(h)));var f=document.querySelectorAll('iframe[data-meancalculator]');for(var i=0;i<f.length;i++)if(f[i].contentWindow===e.source)f[i].style.height=h+'px';});</script>
Dark, for a site with a dark design
The population standard deviation of eight measurements, in dark colours whatever the visitor’s device is set to.
Code
<iframe src="https://meancalculator.com/embed/standard-deviation.html?x=2%2C4%2C4%2C4%2C5%2C5%2C7%2C9&sd=population&theme=dark" title="Standard Deviation Calculator" width="100%" height="720" style="border:0;width:100%;max-width:100%" loading="lazy" allow="clipboard-write" data-meancalculator></iframe>
<p>Standard deviation calculator by <a href="https://meancalculator.com/standard-deviation-calculator.html">MeanCalculator.com</a></p>
<script>addEventListener('message',function(e){if(e.origin!=="https://meancalculator.com"||!e.data||e.data.type!=="meancalculator:height")return;var h=e.data.height;if(typeof h!=='number'||!isFinite(h))return;h=Math.min(6000,Math.max(200,Math.ceil(h)));var f=document.querySelectorAll('iframe[data-meancalculator]');for(var i=0;i<f.length;i++)if(f[i].contentWindow===e.source)f[i].style.height=h+'px';});</script>
Good to know
- Light, dark, or following the device
- If your site has only a light design, choose Light under Theme in the demo; if it has only a dark design, choose Dark. Otherwise a visitor whose device is set to dark sees a dark calculator on your light page. Follow the device suits a site that itself turns dark with the device.
- If your site removes scripts
-
If your site builder takes out the
<script>line, or accepts only an iframe, the calculator still works with the frame alone: it stays 720px high and scrolls inside the frame. - Privacy
- An embedded calculator sets no cookies and loads no analytics. What a visitor types is worked out in their browser and sent to no one; it may be kept in that tab’s session storage for meancalculator.com until the tab is closed. The frame sends your page only its height. See the privacy policy.
Your page sends a Content-Security-Policy (some school and CMS sites)
The policy must allow the frame: add https://meancalculator.com to its frame-src (if it has no
frame-src, to its child-src, or else its default-src). The resize
script is an inline script; if the policy does not allow inline scripts, allow this one by its hash in
script-src (it works only while the script is pasted exactly as given), or leave the script out.
The sources to add:
frame-src https://meancalculator.com
script-src 'sha256-ePm12l+/6EgK8vIMEtyMELHiIxnPpc9Ra7RA9La+B+c='
If the policy’s style-src does not allow inline styles, the browser ignores the frame’s
style and draws its own border round it. Add this rule to your stylesheet; the resize script
still sets the height:
iframe[data-meancalculator] { border: 0; }
See it on another site
tautech.nl/meancalculator.html carries embedded calculators, pasted from the Embed panel. Tautech B.V. runs Mean Calculator.
Next: choose the options in the embed demo.