Embed RealCarCost calculators
Drop a working calculator into your own site or blog post. The embed is responsive, resizes itself to fit its content, and runs entirely in the visitor's browser — no personal or financial data is sent anywhere. Attribution is a small text link only; there's no requirement to link back or use particular anchor text.
EV vs Petrol True Cost Calculator
Compares the total cost of owning an electric car versus petrol, including depreciation, energy or fuel, insurance, tax and servicing.
EV vs Petrol True Cost Calculator
<iframe src="https://realcarcost.co.uk/embed/ev-vs-petrol-cost" title="EV vs Petrol True Cost Calculator" width="100%" height="650" style="border:0" loading="lazy"></iframe>
<script>
window.addEventListener("message", function (e) {
// Only trust resize messages that actually came from realcarcost.co.uk —
// e.origin is set by the browser from the sender's real origin and
// can't be spoofed by page content, so this alone rules out any other
// script on the page (or another embedded site) posting a look-alike
// message.
if (e.origin !== "https://realcarcost.co.uk") return;
if (!e.data || e.data.source !== "realcarcost-embed") return;
// A sane, bounded height only — never trust an arbitrary number blindly.
var height = e.data.height;
if (typeof height !== "number" || !isFinite(height) || height <= 0 || height > 5000) return;
// Match the exact iframe that sent this message (not by src string,
// which would resize every iframe on the page sharing that path) so
// multiple instances of the same calculator each resize independently.
var frames = document.getElementsByTagName("iframe");
for (var i = 0; i < frames.length; i++) {
if (frames[i].contentWindow === e.source) frames[i].style.height = height + "px";
}
});
</script>Salary Sacrifice Car Calculator
Shows the real effective monthly cost of a salary sacrifice car once tax, National Insurance and Benefit-in-Kind are accounted for.
Salary Sacrifice Car Calculator
<iframe src="https://realcarcost.co.uk/embed/salary-sacrifice-car-calculator" title="Salary Sacrifice Car Calculator" width="100%" height="650" style="border:0" loading="lazy"></iframe>
<script>
window.addEventListener("message", function (e) {
// Only trust resize messages that actually came from realcarcost.co.uk —
// e.origin is set by the browser from the sender's real origin and
// can't be spoofed by page content, so this alone rules out any other
// script on the page (or another embedded site) posting a look-alike
// message.
if (e.origin !== "https://realcarcost.co.uk") return;
if (!e.data || e.data.source !== "realcarcost-embed") return;
// A sane, bounded height only — never trust an arbitrary number blindly.
var height = e.data.height;
if (typeof height !== "number" || !isFinite(height) || height <= 0 || height > 5000) return;
// Match the exact iframe that sent this message (not by src string,
// which would resize every iframe on the page sharing that path) so
// multiple instances of the same calculator each resize independently.
var frames = document.getElementsByTagName("iframe");
for (var i = 0; i < frames.length; i++) {
if (frames[i].contentWindow === e.source) frames[i].style.height = height + "px";
}
});
</script>Notes for site owners
- The embed resizes itself via
postMessage— the snippet above includes the small script that listens for it, so no fixed height to guess. Each iframe resizes independently, so you can embed the same calculator more than once on a page. - Embed pages are excluded from search indexing (they're set
noindex) to avoid duplicate content with the full calculator pages. - No cookies, trackers or analytics load inside the embed itself.
- The small "Calculator by RealCarCost" attribution line is optional — add
?attribution=0to the iframe'ssrcto hide it. - Each calculator shows its own built-in disclaimer about the figures being estimates, not financial advice.
- Questions about embedding — [email protected].