One Embed Tag, Any HTML Site, Every Stack
One line of embed code. Works on any HTML page, landing page, or custom-built website. No plugins, no dependencies, no framework required.
Last updated: May 2026Maintained by CalcStack
Why CalcStack
Why CalcStack for HTML / Any Website?
One line of code
A single script tag is all you need. No dependencies, no build step, no framework requirements. Paste it into your HTML and you are live in under 60 seconds.
Works everywhere
Static HTML pages, landing page builders, email platforms with custom code, internal tools, if it supports HTML, it supports CalcStack. No server-side rendering or special hosting required.
Industry benchmarks
Show visitors how they compare to industry averages. Benchmarks increase engagement, time on page, and lead quality because visitors want to know where they stand.
White-label ready
Remove all CalcStack branding on Growth and Agency plans. The tool looks like your own, your colors, your domain, your brand experience.
| Category | Value |
|---|---|
| 2019 (desktop) | 0.50% |
| 2020 (desktop) | 0.90% |
Source: HTTP Archive Web Almanac (Jamstack), 2020Share of web pages built JAMstack-style, which nearly doubled year over year and has kept growing through Astro, Next.js exports, Hugo, and 11ty. On these static builds an iframe embed is the standard way to add interactivity without reintroducing a server.
Anatomy of the CalcStack Embed
Custom HTML sites can add CalcStack lead generation with a single iframe tag. Visitors interact with calculators, scorecards, or quizzes inline; their inputs become qualified leads with full context routed via webhook to your CRM. The embed works on any stack (Astro, Eleventy, plain HTML, or hand-coded sites) with no build step required.
The embed loads inside an isolated iframe. Your HTML page, scripts, and styles remain completely unaffected. The tool communicates lead data back to CalcStack via a secure postMessage bridge, your site never handles sensitive visitor data directly.
This architecture means CalcStack works identically on static hosting (Netlify, Vercel, GitHub Pages), shared hosting, dedicated servers, and local development environments. No server-side configuration is required. According to HTTP Archive's annual Web Almanac and BuiltWith technology surveys, JAMstack and static-site adoption (Hugo, Jekyll, Astro, 11ty, Next.js exports) has grown sharply since 2020, and iframe embeds are the dominant pattern for adding interactive functionality without breaking the static build.
Embed Code Reference
Three ways to embed CalcStack on any HTML page: a raw iframe for maximum control, a script tag with automatic resizing, or a framework component wrapper for React and Vue projects.
Basic iframe embed
<iframe src="https://calcstack.net/embed/profit-margin-calculator?customer=your-id" width="100%" height="600" frameborder="0" loading="lazy"></iframe>Script tag with auto-resize
<div data-calcstack-tool="profit-margin-calculator" data-customer="your-id"></div>
<script src="https://calcstack.net/embed.js"></script>React / Vue component wrapper
<CalcStack tool="profit-margin-calculator" customer="your-id" height={600} onLeadCapture={(lead) => console.log(lead)} />Find your Customer ID in your CalcStack dashboard under Settings. Without a Customer ID, the embed runs as a demo with CalcStack branding and no lead capture.
Common Issues & Troubleshooting
Most HTML embed issues are resolved in under a minute. Here are the three most common problems and their fixes.
iframe blocked by Content Security Policy (CSP) headers
Cause: Your server sends a Content-Security-Policy header that does not allow iframes from external origins. The browser blocks the CalcStack iframe before it can load.
Fix: Add frame-src https://calcstack.net to your CSP headers. The full header should read: Content-Security-Policy: frame-src 'self' https://calcstack.net. If you use a meta tag instead of a header, add the same directive to the content attribute.
Tool does not auto-resize in single-page applications
Cause: Raw iframes do not respond to SPA route changes. When the parent page navigates without a full reload, the iframe height may become stale or the tool may not reinitialize.
Fix: Use the script embed instead of a raw iframe. The script tag handles SPA navigation and dynamic resizing automatically. It listens for DOM mutations and re-initializes when the host element re-enters the page after a route change.
Cross-origin postMessage events not received
Cause: Your event listener does not filter by origin, so messages from CalcStack are either ignored or lost among messages from other iframes and browser extensions.
Fix: Listen for messages from origin https://calcstack.net specifically. Filter by event.data.source === 'calcstack' to avoid conflicts with other iframes. See the resources page for a full postMessage API reference.
Performance, Core Web Vitals, and the Isolated Iframe
The reason an embedded tool does not drag down a hand-built site comes down to process isolation. A cross-origin iframe runs in its own browsing context, with its own JavaScript execution and its own layout work, so the calculator's scripts never compete for the main thread that paints your page. Google's Core Web Vitals measure your document, and the tool's work happens in a separate document, which is why a heavy interactive widget can sit on a landing page without moving its Largest Contentful Paint or its Interaction to Next Paint. The HTTP Archive Web Almanac has documented for years that third-party iframes are the standard mechanism sites use precisely because of this containment.
Layout shift is the metric to watch, and the fix is to reserve space. If you drop a bare iframe with no defined height, the browser lays out the page, then the tool loads and pushes content down, registering a Cumulative Layout Shift penalty. Give the iframe or its container an explicit height up front, or use the auto-resize script which sizes from a placeholder, and the slot is reserved before paint so nothing jumps. A reliable habit on hand-built pages is to set a minimum height on the container that matches the tool's typical first-render size, so even before the iframe paints the page already holds the right amount of vertical space. Pairing that with the loading="lazy" attribute on any tool below the fold defers its network cost until the visitor scrolls near it, keeping your initial page weight lean.
Treat the tool as you would any third-party resource: above the fold, let it load eagerly because it is part of the first impression; below the fold, lazy-load it so it never blocks the critical path. On a static site served from a CDN, the document itself paints almost instantly, and the tool streams in behind it. The visitor sees your page immediately and the interactive element appears a beat later, which is exactly the loading order you want and the one a monolithic, single-bundle approach struggles to achieve.
Accessibility of an Embedded Interactive Tool
When you add a tool to your own HTML, you are responsible for the whole page passing accessibility review, so it is worth knowing how an embed behaves for assistive technology. A screen reader treats the iframe as a distinct region and reads its accessible name, which is why every embed should carry a meaningful title attribute. A title such as "Profit margin calculator" tells a non-sighted visitor what the region contains before they enter it, where an untitled iframe announces only "frame" and leaves them guessing. This single attribute is the highest-leverage accessibility step for any embed.
Keyboard navigation flows naturally across the boundary: a visitor tabbing through your page tabs into the tool, moves through its fields, and tabs back out to the rest of the document, because the browser includes iframe content in the page's focus order. The interactive controls inside the tool, the inputs, sliders, and buttons, are real form elements with labels, so they participate in that focus order rather than trapping the user. You do not need to manage focus across the iframe yourself; the browser does it, which is one fewer thing to get wrong compared with a custom widget glued into your own markup.
The surrounding page still has to do its part. Give the tool a visible heading in your own HTML so sighted and screen-reader users alike understand its purpose in the flow of the page, and make sure the section it sits in has enough contrast and spacing to read on a small screen. The tool handles its internal accessibility; your job is to frame it so it reads as a deliberate, labeled part of the document rather than an unexplained box, and that framing is what keeps the page as a whole compliant. If your audience includes keyboard-only or low-vision users, run a quick pass with the keyboard alone: tab to the tool, complete it, tab out, and confirm focus never gets stuck, which is the same check you would give any interactive region you author yourself.
Static Site Generators and Framework Specifics
Because the embed is plain markup, it slots into any generator's templating without special handling, but each ecosystem has a small gotcha worth knowing. In Markdown-driven generators like Hugo, Jekyll, and Eleventy, raw HTML inside a content file may be escaped by the Markdown processor; the answer is a shortcode or include partial that emits the iframe verbatim, keeping your content files clean while guaranteeing the tag survives the build. In Astro, you can drop the snippet straight into a component or an MDX file, and because Astro ships zero client JavaScript by default the tool remains the only interactive cost on an otherwise static page.
Component frameworks need one extra consideration around their rendering model. A raw iframe will re-mount and reset its state whenever the surrounding component re-renders, so wrap it in a stable boundary, a memoized component, or use the script embed which reattaches itself on DOM changes. For single-page apps that swap routes without a full reload, the script embed is the safer default because it listens for the host element entering the page and re-initializes, where a static iframe can be left with a stale height after navigation. This is the same SPA caveat that applies to most third-party widgets, not something unique to one tool.
None of these stacks require a server. According to BuiltWith adoption data, static-first frameworks have spread well beyond their early developer niche into marketing and content sites, and the appeal is the same everywhere: ship a fast, cacheable document and layer interactivity on with embeds rather than rebuilding the page as an application. A calculator added through an iframe respects that architecture, because it adds a feature without adding a build dependency, a runtime, or a piece of infrastructure you now have to keep alive.
The same reasoning extends to where the site is hosted. Whether you deploy to a managed static host, a generic object store behind a CDN, or a traditional shared server, the embed behaves identically, because all the tool needs from the host is the ability to serve an iframe tag and reach the open web. There is no API route to provision, no environment variable to inject at build time, and no origin secret to protect, since the customer identifier in the embed URL is a public binding that links submissions to your account, not a credential. That keeps the security surface of adding a tool effectively flat: you are publishing one more line of static HTML, and everything stateful, the lead storage, the scoring, the routing, lives off your site entirely.
Popular Lead Generation Tools
These are the most-embedded tools on custom HTML sites. Each one captures qualified leads with industry-specific data. Browse all tools on the resources page.
ROI Calculator
Help prospects calculate return on investment before they buy.
Pricing Calculator
Let visitors configure pricing and see costs in real time.
Break-Even Calculator
Show visitors when their investment will pay for itself.
Profit Margin Calculator
A must-have for e-commerce and SaaS pricing pages.
Mortgage Calculator
Essential for real estate and financial services sites.
Cost Per Lead Calculator
Help marketing teams understand their acquisition costs.
Turn Your HTML / Any Website Visitors Into Qualified Leads
Start with the Free plan, no credit card required. Embed interactive tools and start capturing leads today.
Also available on: