> ## Documentation Index
> Fetch the complete documentation index at: https://crestform.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Embed a form on your website

> Put your form inside a page on your own website, or open it from a button as a popup or a side panel.

Embedding keeps people on your website while they fill in your form. Copy a short piece of code from Crestform and paste it into your page. The form keeps its own design, and every response arrives in Crestform as usual.

> [!NOTE]
>
> Inline embeds are available on every plan. Popup and slider embeds are available on Plus, Pro and Business.

## Choose a style

| Style | What visitors see |
| - | - |
| **Inline** | The form sits inside your page, like any other section. It resizes itself to fit the form as people move through it. |
| **Popup** | A button on your page. Clicking it opens the form in a box in the middle of the screen. |
| **Slider** | A button on your page. Clicking it slides the form in from the right edge. |

People close a popup or slider with the round close button, the Escape key, or by clicking the dimmed page behind it.

## Copy the embed code

**1. Publish the form**

Only a live form can be embedded. See [publishing](https://crestform.io/docs/forms/publish.md).

**2. Open the Share tab**

Open the form, click **Share**, and scroll to **Embed on your website**.

**3. Pick a style**

Click **Inline**, **Popup** or **Slider**. The code below changes to match.

**4. Copy it**

Click the copy button at the top right of the code. A message confirms "Embed code copied".

## Paste it into your site

Most website builders have a block for your own code, often called **HTML**, **Embed**, **Custom code** or **Code**. Add one where you want the form, paste the code in, and save or publish your page. This works the same way in WordPress, Squarespace, Wix, Webflow, Framer and most other builders.

Some builders only run code on the published page, not in their editor. If you see an empty box while editing, publish or preview your site to check the form.

## What the code looks like

Here is an inline embed. Yours has your form's own address in place of the example one.

```html theme={null}
<iframe
  id="cf-form-inline-B4VgyhaD"
  data-cf-src="https://crestform.io/f/B4VgyhaD?embed=true"
  width="100%"
  height="600"
  frameborder="0"
  sandbox="allow-forms allow-scripts allow-same-origin allow-popups"
  referrerpolicy="strict-origin-when-cross-origin"
  style="border:0;border-radius:12px"
  title="B4VgyhaD"
></iframe>
<script>
  (function () {
    var iframe = document.getElementById('cf-form-inline-B4VgyhaD');
    if (!iframe) return;
    var url;
    try { url = new URL(iframe.getAttribute('data-cf-src')); } catch (e) { return; }
    var page = new URLSearchParams(window.location.search);
    ["utm_source","utm_medium","utm_campaign","utm_content","utm_term","fbclid","gclid","gbraid","wbraid","ttclid","msclkid","li_fat_id","twclid"].forEach(function (key) {
      var value = page.get(key);
      if (value) url.searchParams.set(key, value);
    });
    try { url.searchParams.set('cf_ref', new URL(document.referrer).hostname); } catch (e) {}
    iframe.src = url.toString();
    var origin = url.origin;
    window.addEventListener('message', function (event) {
      if (event.origin !== origin) return;
      if (event.source !== iframe.contentWindow) return;
      if (event.data && event.data.type === 'fv:navigate') {
        try {
          var to = new URL(event.data.url);
          if (to.protocol === 'https:' && !to.username && !to.password) window.location.assign(to.href);
        } catch (e) {}
        return;
      }
      if (!event.data || event.data.type !== 'fv:resize') return;
      var height = event.data.height;
      if (typeof height !== 'number' || !isFinite(height) || height <= 0 || height >= 20000) return;
      iframe.style.height = height + 'px';
    });
  })();
</script>
```

If your form sends people to another page after they submit, the whole page goes there, not just the box. A snippet copied before 15 October 2026 still works; it just opens that page inside the box after a short pause. Copy the snippet again from the Share tab to get the new behaviour.

A popup or slider embed is a button and one script:

```html theme={null}
<button data-cf-popup="B4VgyhaD" data-cf-title="Book a discovery call">Open the form</button>
<script
  src="https://crestform.io/embed.js"
  data-cf-src="https://crestform.io/f/B4VgyhaD?embed=true"
  async
></script>
```

You can change the button's words ("Open the form") and style it like your other buttons. Keep its `data-cf-popup` or `data-cf-slider` part, which is what makes it open the form. `data-cf-title` is the name screen readers announce for the open form; the code from your Share tab fills in the form's name, and an older snippet without it still works. Leave the rest of the code as it is.

> [!TIP]
>
> The inline form starts 600 pixels tall and then fits itself to the form. If it stays at 600 on your site, change `height="600"` to a height that suits your form.

## Where visitors came from

An embedded form can't see the address of the page it sits on, so the code passes it along. If someone reaches your page from a link with UTM labels (such as `?utm_source=newsletter`) or from an ad, the form receives those details, plus the name of the site they came from. Their response then says where they came from. See [tracking where people come from](https://crestform.io/docs/share/track-sources.md).

## Related

> [card] [Share your form's link](https://crestform.io/docs/share/form-link.md)
>
> Copy the direct link instead.

> [card] [Track where people come from](https://crestform.io/docs/share/track-sources.md)
>
> See which posts, emails and ads bring in responses.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.