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

  1. Open the calculator you want, for example the weighted mean calculator.
  2. Press Embed, beside Share under the field.
  3. To start it with your own numbers, tick Start with the numbers I have entered.
  4. 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.
  5. 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>
Line by line, for your IT team
1. The frame
The calculator itself, from https://meancalculator.com/embed/weighted-mean.html. Its title names 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-meancalculator marks it for the resize script. At the foot of the calculator is its own credit, “Full calculator on MeanCalculator.com ↗”; credit=off at 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=off it must stay on your page, visible, with the calculator. You may add rel="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 marked data-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 &amp; 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.

x=

The numbers (or grades) the calculator starts with, in place of its worked example.

Values: Numbers separated by commas (fractions such as 7/10 too); on the GPA calculator, one grade per course: A, A-, B%2B for B+ …, P, NP, W, I, AU, or grade points from 0 to 4. · For every calculator · e.g. x=4,7,10

w=

The weights of the values (weighted mean) or the credits of the courses (GPA).

Values: Numbers separated by commas, one for each value in x=; on the GPA calculator, credits, empty for none (w=3,,4). · For Weighted Mean, GPA · e.g. x=85,90,70&w=4,3,2

lv=

Turns on “Weighted (honors, AP, IB)” and sets each course’s level. Read only with x=.

Values: One level per course, separated by commas: 0 for regular, 1 for Honors, 2 for AP, IB or College. · For GPA · e.g. x=A,B&w=3,4&lv=0,2

pg=

The GPA so far, for a cumulative GPA. Read only with pc= and x=.

Values: A GPA from 0 to 4 (to 5 with lv=), with at most 4 decimals. · For GPA · e.g. x=A,B&w=3,4&pg=3.4&pc=30

pc=

The credits so far, for a cumulative GPA. Read only with pg= and x=.

Values: Credits above 0 and below 10000, with at most 3 decimals. · For GPA · e.g. x=A,B&w=3,4&pg=3.4&pc=30

Calculator settings

With the starting numbers, the Embed panel also writes the settings chosen on the calculator’s page, such as Decimals.

mode=

Starts on “Percent changes”: the values in x= are percent changes (x=10,-5 is +10% and −5%), and the result is the average growth rate.

Values: percent · For Geometric Mean · e.g. x=10,20,-5&mode=percent

sd=

Shows the population standard deviation first; the sample standard deviation is the default.

Values: population · For Standard Deviation · e.g. sd=population

d=

Decimals: how many decimals the result shows. The default is Auto (as many as the figures need), except on the GPA calculator, which shows 2; d=auto gives it Auto. Visitors can still change it, unless decimals=off hides the setting.

Values: 0 to 6, or auto · For every calculator · e.g. d=2

ci=

The confidence level of the interval for the mean; 95% is the default.

Values: 90 or 99 · For Descriptive Statistics · e.g. ci=99

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.

steps=

closed: the steps start closed; the visitor can open them. off: no steps. Left out: open for up to 25 values (or courses), closed for more.

Values: closed or off · For every calculator · e.g. steps=closed

chart=

No number line or chart.

Values: off · For every calculator except GPA · e.g. chart=off

figures=

Only the headline and the figure beside it, and no “Copy all results”; “Copy result” stays.

Values: off · For every calculator · e.g. figures=off

examples=

No examples above the field.

Values: off · For Weighted Mean, Descriptive Statistics · e.g. examples=off

used=

No “Values used” line above the result, and so none of its buttons (Copy, Copy as column).

Values: off · For every calculator except GPA · e.g. used=off

decimals=

No Decimals setting beside the result, so visitors cannot change the decimals. The result keeps those of d= if the address has it, otherwise the calculator’s default. Not to be confused with d=, which sets how many.

Values: off · For every calculator · e.g. d=2&decimals=off

Theme

In the demo: Theme (Follow the device, Light, Dark).

theme=

Light or dark colours whatever the visitor’s device is set to. Left out, the calculator follows the device.

Values: light or dark · For every calculator · e.g. theme=dark

Credit

In the demo: Show the credit inside the calculator, under Credit.

credit=

Hides the credit at the foot of the calculator, “Full calculator on MeanCalculator.com ↗”. Only for a page that keeps the link under the frame, which is then required (see Terms of use). Left out, the credit shows.

Values: off · For every calculator · e.g. credit=off

Each calculator
Full pageEmbed addressParts 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.

Options: x=78,85,92 · w=20,30,50 · steps=closed
Try it in the demo

Live, on this page:

Weighted mean calculator by MeanCalculator.com

Code
<iframe src="https://meancalculator.com/embed/weighted-mean.html?x=78%2C85%2C92&amp;w=20%2C30%2C50&amp;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.

Options: x=12,15,9,20,14 · steps=off · figures=off
Try it in the demo

Code
<iframe src="https://meancalculator.com/embed/mean.html?x=12%2C15%2C9%2C20%2C14&amp;steps=off&amp;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.

Options: x=A,B%2B,A-,B · w=3,4,4,3 · steps=closed · theme=light
Try it in the demo

Code
<iframe src="https://meancalculator.com/embed/gpa.html?x=A%2CB%2B%2CA-%2CB&amp;w=3%2C4%2C4%2C3&amp;steps=closed&amp;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.

Options: x=2,4,4,4,5,5,7,9 · sd=population · theme=dark
Try it in the demo

Code
<iframe src="https://meancalculator.com/embed/standard-deviation.html?x=2%2C4%2C4%2C4%2C5%2C5%2C7%2C9&amp;sd=population&amp;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.

Cite this page

Embed a Calculator on Your Site. https://meancalculator.com/embed-a-calculator.html