Jomatter

How to Embed a Google Form in HTML

You can embed a Google Form directly into an HTML webpage by using the embed code generated by Google Forms. Google provides this code as an <iframe>, so you do not need to build the form fields yourself or create a custom form-processing system.

The process is simple: open your Google Form, get the Embed HTML code, copy it, and paste it into the HTML where you want the form to appear.

1. Open your Google Form

Open Google Forms and select the form you want to place on your website. Make sure the form is ready for responses and that its responder access settings allow your intended visitors to open and submit it.

Google’s current Forms system uses publishing and responder-access controls, so a form that works for you as the owner may not automatically be accessible to every website visitor. Check those settings before testing the embedded form.

2. Get the Google Form embed code

Inside Google Forms, open the form and use the top-right controls. Google currently provides an Embed HTML option from the More menu.

Select:

More → Embed HTML

Google then displays the HTML code required to embed the form. Click Copy to copy the code. The exact values for the form URL, width, and height can vary, but the generated code normally uses an <iframe>.

The code will look similar to this:

<iframe
  src="https://docs.google.com/forms/d/e/YOUR_FORM_ID/viewform?embedded=true"
  width="640"
  height="800"
  frameborder="0"
  marginheight="0"
  marginwidth="0">
  Loading…
</iframe>

Use the actual code generated by Google Forms. Do not replace the src with the URL you use to edit the form.

3. Paste the code into your HTML

Open the HTML page where you want the form to appear. Paste the iframe code inside the <body> section, exactly where the form should be displayed.

For example:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Contact Us</title>
</head>
<body>

  <h1>Contact Us</h1>
  <p>Complete the form below.</p>

  <iframe
    src="https://docs.google.com/forms/d/e/YOUR_FORM_ID/viewform?embedded=true"
    width="640"
    height="800"
    frameborder="0"
    marginheight="0"
    marginwidth="0">
    Loading…
  </iframe>

</body>
</html>

When the page loads, the Google Form appears directly inside the webpage instead of requiring the visitor to open a separate Google Forms page.

4. Make the Google Form responsive

A fixed iframe width such as 640px may be too wide for phones. For a responsive layout, change the iframe width to 100% so it can use the available space.

<div class="google-form">
  <iframe
    src="https://docs.google.com/forms/d/e/YOUR_FORM_ID/viewform?embedded=true"
    width="100%"
    height="800"
    frameborder="0"
    marginheight="0"
    marginwidth="0">
    Loading…
  </iframe>
</div>

You can also add CSS:

<style>
.google-form {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.google-form iframe {
  width: 100%;
  border: 0;
}
</style>

The width can be responsive, but the height normally needs a fixed value. Increase the height if your form contains many questions or sections.

5. Test the embedded form

After adding the iframe, open the webpage and test the form from beginning to end. Check it on both desktop and mobile.

Make sure the form loads, all questions are visible, the submit button is accessible, and a test response can be submitted successfully. Testing while signed out or in a private browser window can also reveal responder-access restrictions that are hidden when you are logged into the form owner’s Google account.

Common Google Form embedding problems

The form does not load: Check that you copied the complete iframe code from Google Forms and did not remove part of the src URL.

Visitors see a permission message: Review the form’s responder access and publishing settings. Google Forms now provides more granular controls for who can access and respond to a form.

The form is cut off: Increase the iframe height. For example:

<iframe
  src="YOUR_GOOGLE_FORM_EMBED_URL"
  width="100%"
  height="1200"
  frameborder="0">
</iframe>

The form is too wide on mobile: Use width="100%" and make sure the parent container does not have a larger fixed width.

Complete responsive example

For a typical website, this structure is enough:

<div class="google-form">
  <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>
</div>

Replace the example URL with the actual embed code generated by Google Forms. Do not manually guess the form ID or build a different URL when Google has already supplied the correct embed code.

In short, to embed a Google Form in HTML, open the form, choose More → Embed HTML, copy Google’s iframe code, and paste it into your webpage. Set the iframe width to 100% for a mobile-friendly layout and adjust the height so the entire form is usable.

Relevant Guide

How To Remove Html Tags From An Image
How To Center An Image In Html
Can I Use Html With The Traffic Pass Safelist App
How To Add Html To Lioden Profile
How To Add Html Signature To Apple Mail
How To Add Textures In Html Games
How Do You Indent In Html
How Long Does It Take To Learn Html
How To Convert Html To Excel