# A quantity calculator in a Squarespace Code block

> Put a free quantity calculator on a Squarespace 7.1 page with a Code block: the plans that allow it, the exact clicks, the code and what to check.

Page: https://craftquantities.com/embeds/squarespace/ (embed guide). This is the page's Markdown copy; the HTML page is the canonical version.

A **Code block** writes your HTML straight into the page, so the calculator's frame, its credit line and the script that fits its height all work as written. The one thing to know first is the plan: Squarespace allows iframes and JavaScript in Code blocks on its Core, Plus and Advanced plans.

- Code block Element
- Runs (HTML mode)Fitting script
- Core, Plus, Advanced Plans
- 400 KB Block limit

**On this page Before you start**

## Before you start

- A Squarespace 7.1 site on the **Core**, **Plus** or **Advanced** plan; the other plans do not run iframes or scripts in a Code block.
- The page open in the editor, with a section where the calculator should go.
- A private browser window for the last check, because code may not show to a logged-in editor.

## Step by step

1. Edit the page

   Open the page and click **Edit**. Hover where the calculator should go and click **Add block** (or the **+**).
2. Choose Code

   Pick **Code** from the block menu. A placeholder block appears in the section.
3. Open the block's editor

   Click the block's pencil icon. Leave the mode on **HTML** and keep **Display Source** off; with it on, Squarespace prints the code as text instead of running it.
4. Paste and apply

   Replace the placeholder with the code below, close the editor and resize the block's width in the section grid if you need to.
5. Save and check logged out

   Click **Save**, then open the page in a private window, or use **Preview in Safe Mode**, to see the calculator as visitors do.

## Your code

_Code block (HTML mode)_

```
<iframe src="https://craftquantities.com/embed/?calc=wallpaper-calculator&ev=1&fmt=compact" width="100%" height="460" loading="lazy" style="border:1px solid #e4e4e7;border-radius:12px;max-width:100%" title="Wallpaper Calculator — Craft Quantities"></iframe>
<p style="margin:4px 0 0;font:12px/1.4 system-ui,sans-serif">Calculator by <a href="https://craftquantities.com/calculators/renovation-construction/wallpaper-calculator/">Craft Quantities</a></p>
<script>(function(){if(window.cqEmbedFit)return;window.cqEmbedFit=1;window.addEventListener("message",function(e){var d=e.data;if(!d||d.source!=="craft-quantities"||d.type!=="size"||typeof d.height!=="number"||!isFinite(d.height))return;var f=document.getElementsByTagName("iframe");for(var i=0;i<f.length;i++){if(f[i].contentWindow!==e.source)continue;var a=document.createElement("a");a.href=f[i].src;if(a.protocol+"//"+a.host!==e.origin)return;f[i].style.height=Math.min(6000,Math.max(200,Math.ceil(d.height)))+"px";return}})})();</script>
```

The frame, the credit line and the fitting script. The block's limit is 400 KB; this is under 2 KB.

Every other option is in the [full builder](https://craftquantities.com/embeds/#calculator=wallpaper-calculator).

## What visitors see

Your Squarespace page · Shop · Wallpaper

Calculator by [Craft Quantities](https://craftquantities.com/calculators/renovation-construction/wallpaper-calculator/)

## Sizing the block in a 7.1 section

Squarespace 7.1 places blocks on a grid inside each section: drag the Code block's edges to set how many columns it spans, and the frame inside takes that width. A compact calculator reads well across half to two thirds of a desktop section; the full calculator wants the whole width.

The grid keeps a separate arrangement for phones. Switch the editor to its mobile view and check that the block spans the full width there and that nothing sits on top of it.

Give the block's height room to grow. The fitting script makes the frame taller as the reader opens results, and a block squeezed between two others pushes them down rather than cutting the calculator off.

## Troubleshooting

**The code shows as text**

**Display Source** is switched on in the block's editor. Switch it off and save.

**Nothing shows while I am logged in**

Squarespace may not run a Code block's scripts for a logged-in editor. Use **Preview in Safe Mode**, or open the page in a private window.

**The block says iframes or scripts are not allowed**

The site's plan does not include them. Iframes and JavaScript in Code blocks need Core, Plus or Advanced.

**It works on the page but not on an index or summary**

Code may not render on index pages or with Ajax loading on. Put the calculator on the page itself, or give the iframe a fixed height and drop the script line.

**The editor freezes after adding the code**

Turn on **Disable Scripts in Preview**, as Squarespace's Code block help page describes, then edit the block again.

## Why it helps

- A wallpaper, tile or paint shop on Squarespace Commerce can answer "how many rolls?" on the page that sells them.
- A designer's or contractor's portfolio gains something useful to do, which keeps a visitor on the site a little longer than a gallery alone.
- The calculator stays current on its own: fixes and new calculators reach your page without editing the block again.

## Sources

Checked against these help pages on 26 November 2026.

1. [Squarespace Help Center: Code blocks](https://support.squarespace.com/hc/en-us/articles/206543167-Code-blocks)
2. [Squarespace Help Center: Embed blocks](https://support.squarespace.com/hc/en-us/articles/206543617-Embed-blocks)

On this page

At a glance

**Element**

Code block

**Fitting script**

Runs (HTML mode)

**Plans**

Core, Plus, Advanced

**Block limit**

400 KB

Official links

- [The plugin on WordPress.org](https://wordpress.org/plugins/craft-quantities-calculators/)
- [Developer hub](https://craftquantities.com/developers/)
- [Static JSON API](https://craftquantities.com/api/)
- [Remote MCP server](https://craftquantities.com/developers/mcp/)
- [npm package](https://craftquantities.com/developers/npm/)

The one rule

Keep the visible credit line under the frame: it is the one condition of the free embed.

**Open:** the engine’s answers (its JSON API, MCP server and npm package), the data files under /api/v1/ and the formula library (/formulas/) are published under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/): reuse them, commercially too, crediting “Craft Quantities” with a link. **Reserved:** the page text, the design and the software, the engine’s code included. [The terms of use](https://craftquantities.com/terms/)

[The terms, in full](https://craftquantities.com/embeds/#terms)

[Home](https://craftquantities.com/)

Embed & integrations

Pages

- [Overview and builder](https://craftquantities.com/embeds/)
- [WordPress plugin](https://craftquantities.com/embeds/wordpress/)
- [Shopify](https://craftquantities.com/embeds/shopify/)
- [Wix](https://craftquantities.com/embeds/wix/)
- [Squarespace](https://craftquantities.com/embeds/squarespace/)
- [Webflow](https://craftquantities.com/embeds/webflow/)
- [Google Sites](https://craftquantities.com/embeds/google-sites/)
- [Blogger](https://craftquantities.com/embeds/blogger/)
- [Any HTML page](https://craftquantities.com/embeds/html/)

Developers & integrations

- [Overview and live call](https://craftquantities.com/developers/)
- [API reference](https://craftquantities.com/developers/api-reference/)
- [Static JSON API](https://craftquantities.com/api/)
- [Remote MCP server](https://craftquantities.com/developers/mcp/)
- [npm package](https://craftquantities.com/developers/npm/)
- [Command line](https://craftquantities.com/developers/cli/)
- [WebMCP in the browser](https://craftquantities.com/developers/webmcp/)
- [Claude and ChatGPT](https://craftquantities.com/ai/)
- [Embeds and WordPress](https://craftquantities.com/embeds/)
- [Browser extension](https://craftquantities.com/tools/browser-extension/)
- [Changelog](https://craftquantities.com/developers/changelog/)
- [Service status](https://craftquantities.com/status/)

On this page

- Before you start
- Step by step
- Your code
- What visitors see
- Sizing the block in a 7.1 section
- Troubleshooting
- Why it helps
- Sources

---
Source: https://craftquantities.com/embeds/squarespace/
Craft Quantities: free to read, cite and link to; the pages are not licensed for republication. Quantities only: no prices, no design and no certification.
