How to Embed a Form in Wix Studio: Embed Code and Custom Code
Embed a contact form, Google Form or HubSpot form in Wix Studio with the Embed Code element, size it for every breakpoint, and fix embeds that are blank or cut off.
Nisuform team
11 min read

Short answer: In the Wix Studio Editor, click Add Elements, then Embed & Social, then Embed Code. Click Enter Code, paste your form's HTML and click Apply. Drag the box until the whole form shows, then check it again at the tablet and mobile breakpoints, because the box keeps the height you give it. The same steps work for a Nisuform form, Google Forms, HubSpot or any form that comes with embed code.
Wix runs the code in a sandboxed iframe, so the form has to bring its own styles. This contact form is complete and works as pasted:
<style>
body { margin: 0; font-family: system-ui, sans-serif; color: #18181b; }
form { display: grid; gap: 14px; max-width: 480px; padding: 4px; }
label { display: grid; gap: 6px; font-size: 15px; font-weight: 500; }
input, textarea { font: inherit; padding: 10px 12px; border: 1px solid #d4d4d8; border-radius: 10px; }
button { font: inherit; font-weight: 600; padding: 12px; border: 0; border-radius: 10px; background: #116dff; color: #fff; cursor: pointer; }
.hp { display: none; }
</style>
<form id="contact" action="https://api.nisuform.com/s/YOUR_FORM_KEY" method="POST">
<label>Name <input name="name" autocomplete="name" required></label>
<label>Email <input type="email" name="email" autocomplete="email" required></label>
<label>Message <textarea name="message" rows="5" required></textarea></label>
<input class="hp" type="text" name="_gotcha" tabindex="-1" autocomplete="off">
<button type="submit">Send message</button>
<p id="status" role="status"></p>
</form>
<script>
const form = document.getElementById('contact')
const status = document.getElementById('status')
const shownAt = Date.now()
form.addEventListener('submit', async (event) => {
event.preventDefault()
const data = new FormData(form)
data.set('_elapsed', String(Date.now() - shownAt))
const button = form.querySelector('button')
button.disabled = true
try {
const response = await fetch(form.action, {
method: 'POST',
headers: { Accept: 'application/json' },
body: data,
})
const result = await response.json()
status.textContent = result.ok ? 'Thanks! Your message was sent.' : result.message
if (result.ok) form.reset()
} catch {
status.textContent = 'Something went wrong. Please try again.'
} finally {
button.disabled = false
}
})
</script>Replace YOUR_FORM_KEY with the key from a free Nisuform form. Every message then lands in your Nisuform inbox and your email, with spam filtered out.
Ways to add a form in Wix Studio
Wix Studio has five places where a form or form code can go. Most sites only need the first or the second.
| Option | Where in Wix Studio | Plan | Use it for |
|---|---|---|---|
| Wix Forms | Add Elements, Contact & Forms | Any, with limits per plan | Forms that only live on this Wix site and feed Wix's contacts and Automations |
| Embed Code | Add Elements, Embed & Social, Embed Code | Any | HTML forms, form backends, Google Forms, HubSpot, Jotform, Typeform |
| Embed Site | Add Elements, Embed & Social, Embed Site | Any | A form that has its own web address, shown in a frame |
| Custom Element | Add Elements, Embed & Social, Custom Element | Connected domain, no Wix ads | Developers loading a web component from a JavaScript file |
| Custom Code | Settings, Custom Code in the site dashboard | Connected domain | Scripts for every page, like analytics or a popup tool. There's nothing to place on the canvas |
Most of this guide covers Embed Code, the element that takes a form's embed code. Custom Code and custom elements and Wix Forms or an embedded form cover the other options.
Embed a form with the Embed Code element
Copy the form's embed code
For a Nisuform form, create a form, add your fields in the builder and save. On the form's Setup tab, choose Site builder, then Wix, then Copy the embed code. The code includes the form's styles, spam checks and success message. You can also paste the hand-written form at the top of this guide.
Google Forms, HubSpot, Jotform and most other form tools have a share or embed option that gives you an
<iframe>or a<script>tag. Both work in the Embed Code element.Add an Embed Code element
In the Wix Studio Editor, click Add Elements on the left, then Embed & Social, then Embed Code. Wix adds an empty box to the page. Drag it into the section where the form should go.
Paste the code
Select the box, click Enter Code, paste the embed code into the text box and click Apply. The form appears inside the box on the canvas.
Size the box for every breakpoint
Drag the box's edges until the whole form shows, plus about 60 pixels below the button for an error message. Then switch to the tablet and mobile breakpoints and do the same. Size the embed for desktop, tablet and mobile has the details.
Publish and send a test
Publish the site, open the live page and send yourself a message. With Nisuform, wait at least 2 seconds before you press send, because faster submissions are dropped as bots. The message should reach your inbox and your email within seconds.
Size the embed for desktop, tablet and mobile
An Embed Code element is an iframe with a fixed size. It keeps the height you drag it to, and when the form inside is taller, the bottom is cut off or scrolls inside the box. The form can't resize the box from inside the iframe.
Wix Studio keeps a size for each breakpoint. A size you set on desktop carries down to tablet and mobile until you change it there, so a box that fits on desktop is usually too short on a phone, where labels and long text wrap onto more lines. To get it right:
- Set the width in percent. A width like 100% of the section lets the box narrow with the screen. The Nisuform embed grows up to 480 pixels wide and fills narrower boxes.
- Leave room for an error message. A rejected submission shows a message under the button, about 60 pixels tall. If the box has no room for it, visitors never see why their message didn't send.
- Check each breakpoint. Switch to tablet and mobile in the editor, drag the box taller where the form is cut off, and make sure the element isn't hidden at that breakpoint.
- The success message fits the same box. After a submit, the Nisuform embed swaps the form for a success message that is never taller than the form.
Embed code from other tools often sets its own size, like width="640" height="800" on an iframe. Change the width to 100% so it follows the box, and set the height to fit the form.
Style the form inside the iframe
Wix serves the code in an Embed Code element as its own small page, inside a sandboxed iframe. Your Wix site's fonts, colors and theme don't reach inside it, and the code can't see or change the rest of your page. So the form needs:
- Its own CSS. Put a
<style>tag in the code, as in the form at the top. The Nisuform embed already carries its styles, and you pick its theme and accent color in the builder. - Its own fonts. To match a Google Font your site uses, add its
<link>tag at the top of the code and setfont-familyin the CSS. - HTTPS everywhere. Wix doesn't show anything loaded over
http://on the live site, so every script, stylesheet and image in the code needs anhttps://address.
Wix's sandbox allows scripts, forms and popups, so a form posts and shows its success message normally.
Show a success message instead of a redirect
A form in an iframe can only navigate the iframe. If your form redirects to a thank-you page after a submit, that page loads inside the embed box, often cut off, while the rest of your Wix page stays the same. Without JavaScript, a plain HTML form does the same with the form service's thank-you page.
On Wix, keep the form's success message. The Nisuform embed replaces the form with your Success message from the builder, in the same box. If you write your own form, use fetch and show a message, as the example at the top does. To count conversions, track the success message instead of a thank-you page view.
Allowed websites and the filesusr.com address
Wix hosts Embed Code content on its own file domain, at an address built from your site's address, like https://www-example-com.filesusr.com. Your form's requests carry that address in their Origin header, instead of https://www.example.com.
If you turn on allowed websites with only your own domain in the list, posts from your own Wix page are rejected with origin_not_allowed. To find the address to add:
- Publish the site and open the page with the form.
- Open your browser's developer tools and go to the Network tab.
- Send a test and click the request to
api.nisuform.com. - Copy the value of the
Originrequest header and add it to the form's allowed websites.
If you use Cloudflare Turnstile, the widget loads inside the iframe too, so add the same hostname, like www-example-com.filesusr.com, to your Turnstile widget's hostnames.
Embed Google Forms, HubSpot and other form tools
The Embed Code element takes any form tool's embed code. Responses go to that tool, not to your Wix dashboard.
Google Forms
In Google Forms, click Send, open the embed tab marked with <>, and copy the code. It looks like this:
<iframe src="https://docs.google.com/forms/d/e/YOUR_FORM_ID/viewform?embedded=true" width="100%" height="900" frameborder="0" marginheight="0" marginwidth="0">Loading…</iframe>Google gives you width="640". Change it to 100% as above, and set height to the height of your form. Paste it into an Embed Code element and make the box the same height, or slightly taller. A Google Form taller than its iframe scrolls inside the box, which is easy to miss on a phone.
You can also skip the code. Add an Embed Site element, click Change Website Address, paste the form's link and click Update.
HubSpot, Jotform, Typeform and Mailchimp
Copy the embed code from the form's share or embed settings in the tool and paste it into an Embed Code element. Inline forms work this way.
Popup, slide-in and sticky-bar forms only show inside the box, because code in an Embed Code element can't reach the rest of your page. For those, use the tool's app from the Wix App Market if it has one, or add its script under Custom Code.
Custom Code and custom elements
Both features take code, and neither is the usual home for an inline form:
- Custom Code is in your site's dashboard, under Settings, Custom Code. It adds a script to the head, the start of the body or the end of the body, on every page or the pages you pick. It needs a published site with a connected domain. It suits analytics, chat widgets and popup tools, and gives you nothing to place on the canvas, so an inline form still goes in an Embed Code element.
- Custom Element is in Add Elements, Embed & Social. It loads a web component from a JavaScript file you host with Velo or on your own server, under a tag name with a dash, like
contact-form. It needs a connected domain and no Wix ads, and suits developers who already write web components.
Wix Forms or an embedded form
Wix Forms is built into Wix Studio. Click Add Elements, then Contact & Forms, and create a form or pick a template. Submissions go to Forms & Submissions in your dashboard, and a Wix Automation emails you about each one. Keep Wix Forms when the form only lives on this site and you want submissions in Wix's contacts, Automations or payments.
Each Wix plan caps how many forms a site can have, how many fields each form holds and how many people get the notification email. On the Combo plan, for example, Wix lists 4 forms, 10 fields per form and 2 email recipients, and the file upload field needs a Business plan. Plans vary by location, so check Wix's own list for yours.
An embedded form makes sense when:
- The form runs on more than one site. Paste the same embed code on your Wix site and a landing page hosted elsewhere, and every submission lands in one inbox.
- You need more fields or file uploads. A Nisuform form holds up to 30 fields in the builder, and file uploads come with Pro at $10 a month.
- Submissions go somewhere other than email. On Pro, Nisuform sends each submission to Slack, Discord, Telegram or Google Sheets, or to your own code with a webhook.
- You might move off Wix. The form, its inbox and its history stay the same when the site changes builders.
Nisuform's Free plan includes 3 forms and 100 submissions a month. If the only problem with Wix Forms is a missing notification email, fix that first. Wix contact form to email covers where Wix sends notifications and why they go missing.
Wix Studio embed code not working?
| What you see | Likely cause | Fix |
|---|---|---|
| A blank box on the live site | The code loads something over http://, or the embedded site refuses to be shown in a frame | Use https:// addresses. For Embed Site, check that the site allows embedding |
| The bottom of the form is cut off | The box is shorter than the form | Drag the box taller, with about 60 pixels for an error message |
| Fine on desktop, cut off or missing on mobile | The mobile breakpoint has its own height, or the element is hidden there | Switch to the mobile breakpoint, resize the box and check that it's shown |
| The form doesn't use your site's fonts | The code runs in its own iframe | Add CSS and font links to the code |
| A thank-you page opens inside the box | The form redirects after a submit, or JavaScript is off | Switch to a success message |
An origin_not_allowed error | Allowed websites lists your domain, not the filesusr.com address | Add the address from the request's Origin header |
| A widget can't find elements on your page | Code in an Embed Code element can't reach the page | Use Custom Code, a custom element or the tool's Wix app |
Checklist before you publish
- The form's code is in an Embed Code element, pasted with Enter Code and Apply.
- Every address in the code starts with
https://. - The box shows the whole form and room for an error message at desktop, tablet and mobile.
- The form carries its own CSS, since your Wix styles don't reach inside the iframe.
- A submit shows a success message in the box, with no redirect.
- If allowed websites are on, the list has the filesusr.com address from the request's
Originheader. - A test from the live site reached your inbox and your email.
For the Wix setup in the Nisuform docs, see Wix forms. To keep bots out of the form, see how to stop contact form spam.
Frequently asked questions
How do I embed a form in Wix Studio?
In the Wix Studio Editor, click Add Elements, then Embed & Social, then Embed Code. Click Enter Code, paste the form's HTML and click Apply. Drag the box until the whole form shows, check the tablet and mobile breakpoints, then publish and send a test from the live site.
Can I embed a Google Form in Wix Studio?
Yes. In Google Forms, click Send, open the embed tab marked with angle brackets and copy the iframe code. Paste it into an Embed Code element, change width="640" to width="100%", and make the box tall enough for the whole form. You can also paste the form's link into an Embed Site element instead.
Why is my embedded form cut off in Wix Studio?
Wix Studio shows embedded code in a box with a fixed height, and the box never grows to fit what is inside it. Drag the box taller until the whole form shows, with room for an error message, then switch to the tablet and mobile breakpoints and check the height there too. The form wraps onto more lines on narrow screens, so it needs a taller box.
Why is my Wix Studio embed code not working?
A blank box usually means the code loads something over http instead of https, the site you embedded refuses to be shown in a frame, or the code needs to reach the rest of your page, which code in an Embed Code element can't do. Test on the published site, open the browser console and look for blocked requests.
Do I need a paid Wix plan to embed a form?
Not for the Embed Code element. Custom Code under your site's settings needs a connected domain, and custom elements need a connected domain and no Wix ads, so both need a paid plan. A form only needs the Embed Code element.
Where do submissions from an embedded form go?
To the service that owns the form, not to Forms & Submissions in your Wix dashboard. A Nisuform form saves each submission to your Nisuform inbox and emails you, a Google Form saves to Google Forms or a linked Google Sheet, and a HubSpot form saves to HubSpot.
Can an embedded form redirect to a thank-you page on my Wix site?
Not cleanly. The embed runs in an iframe, so a redirect after submit loads the thank-you page inside the embed box instead of the whole window. On Wix, keep the form's success message, which replaces the form in the same box.
Does Wix Studio have its own form builder?
Yes. Wix Forms is built in. Click Add Elements, then Contact & Forms, and create a form or pick a template. Submissions go to Forms & Submissions in your dashboard. Each Wix plan caps how many forms you can have, how many fields each form holds and how many people get the notification email.

