Embed a HubSpot form in a shared HTML page
A landing page or proposal with a HubSpot form on it. Which embed code works, why the form disappears when the file is opened from disk, what a wrong form ID shows, and how to share the page as a link.
Ask Claude or ChatGPT for a landing page "with our HubSpot form" and it adds HubSpot's embed script or an <iframe> to the form's share link. Both can work in a shared page. Two details decide whether the form shows up.
The tests below were run in headless Chrome against a public HubSpot form, on a page served over http and on the same file opened from disk. No form was submitted.
Use the embed code from HubSpot
In HubSpot, open the form, choose Share or Embed, and copy the code. For forms made in HubSpot's older form editor it loads js.hsforms.net/forms/embed/v2.js and calls hbspt.forms.create with your portalId and formId.
Tested: that code drew the form fields straight into the page, not inside a frame, so the page's own fonts and CSS apply to them. Style the form in your page or in HubSpot's form settings.
Tested: with the second script and no v2.js script above it, nothing appeared and the browser console showed "hbspt is not defined". Keep both scripts, the v2.js one first.
Forms made in HubSpot's newer editor give a different snippet with a div of class hs-form-frame. That snippet was not part of this test.
A share link iframe also works
Every HubSpot form has a share link at share.hsforms.com. Tested: <iframe src="https://share.hsforms.com/..." width="600" height="900"> showed the full form with HubSpot's own styling inside the frame. The frame does not resize to the form, so set a height that fits it.
Use your form ID
The portalId and formId have to come from your HubSpot account. AI tools often fill in placeholders.
Tested: a formId that does not exist left the page blank where the form should be, with no message on the page. If the form is missing, check the two IDs against the embed code in HubSpot.
Opening the file from your computer
HubSpot's code often writes the script address as //js.hsforms.net, with no https: in front. Tested: opened from disk (a file:/// address), that page showed no form, because the browser looked for the script on your computer. The same page over http showed the form.
Tested: changing the address to https://js.hsforms.net/forms/embed/v2.js made the form load from disk too. The share link iframe loaded from disk either way.
Upload it and send the link
Drag the HTML file onto the FileShare Pro dashboard and copy the link. Shared pages load over https, so the //js.hsforms.net address works there. Viewers need no account on FileShare Pro. The shared view does not restrict frames or scripts inside your page. Submissions go to your HubSpot account, not to FileShare Pro.
Change the form in HubSpot and the embedded form shows it on the next load; the page and the link stay the same. Related: a Google Form in a shared page, a Typeform in a shared page and a waitlist page as a link.
Frequently asked
No. The test form loaded its fields with no sign-in.
No. The password protects the page. The form's IDs are in the page source and its share link works on its own: password-protecting an HTML page.
No. Shared files carry a noindex header: keeping a preview out of Google.
Drop the file, copy the link — live in seconds, free plan included.
Start sharing free