Beginner4 minUpdated Mar 15, 2026

How to Add a Contact Form to a Static Site

Add a fully functional contact form to any static site generator: Jekyll, Hugo, Eleventy, Astro, or plain HTML. No server-side code required.

TL;DR

To add a contact form to a static site (HTML, Jekyll, Hugo, Eleventy, etc.), use a form backend service like FormsList. Set your form's action to `https://formslist.com/f/your-form-id`. FormsList processes submissions and sends notifications without requiring any server-side code.

By Vaibhav Jain·Published March 15, 2026

Prerequisites

  • A static site (Jekyll, Hugo, Eleventy, Astro, or plain HTML)
  • A FormsList account (free)
  • A hosting platform (Netlify, Vercel, GitHub Pages, etc.)
1

Why static sites need a form backend

Static site generators produce plain HTML, CSS, and JavaScript files with no server-side processing. When a visitor submits a form, there is no server to receive the data. A form backend service like FormsList solves this by providing an external endpoint that accepts POST requests and handles storage, validation, and email delivery.

2

Add the form to your static site template

Add a standard HTML form to your template or page. It works the same way regardless of your static site generator: Jekyll, Hugo, Eleventy, Astro, or plain HTML. The form posts to a FormsList endpoint, which processes the submission externally.

<!-- Works with any static site generator -->
<form action="https://formslist.com/f/YOUR_FORM_HASH" method="POST">
  <div style="margin-bottom:1rem;">
    <label for="name" style="display:block;font-weight:600;">Name</label>
    <input type="text" id="name" name="name" required
      style="width:100%;padding:8px;border:1px solid #d1d5db;border-radius:4px;" />
  </div>
  <div style="margin-bottom:1rem;">
    <label for="email" style="display:block;font-weight:600;">Email</label>
    <input type="email" id="email" name="email" required
      style="width:100%;padding:8px;border:1px solid #d1d5db;border-radius:4px;" />
  </div>
  <div style="margin-bottom:1rem;">
    <label for="message" style="display:block;font-weight:600;">Message</label>
    <textarea id="message" name="message" rows="5" required
      style="width:100%;padding:8px;border:1px solid #d1d5db;border-radius:4px;"></textarea>
  </div>
  <button type="submit"
    style="padding:10px 24px;background:#2563eb;color:white;border:none;border-radius:4px;cursor:pointer;">
    Send Message
  </button>
</form>

<!-- Optional: AJAX submission for a smoother experience -->
<script>
  document.querySelector("form").addEventListener("submit", async (e) => {
    e.preventDefault();
    const form = e.target;
    const btn = form.querySelector("button");
    btn.disabled = true;
    btn.textContent = "Sending...";

    const res = await fetch(form.action, { method: "POST", body: new FormData(form) });

    if (res.ok) {
      form.innerHTML = "<p style='color:#16a34a;font-weight:600;'>Thank you! Your message has been sent.</p>";
    } else {
      btn.disabled = false;
      btn.textContent = "Send Message";
      alert("Something went wrong. Please try again.");
    }
  });
</script>
3

Deploy and test

Build and deploy your static site as usual. The form works on any hosting platform: Netlify, Vercel, GitHub Pages, Cloudflare Pages, or any web server. Submit a test entry and check the FormsList dashboard. Enable email notifications to receive submissions in your inbox.

Frequently Asked Questions

How do I add a contact form to a static website?

Use a form backend service like FormsList. Add a standard HTML form to your static site and set the action attribute to a FormsList endpoint URL. FormsList handles submissions externally. No server-side code needed.

How do I handle forms on a Jekyll or Hugo site?

Add an HTML form to your template that posts to a FormsList endpoint. Static site generators produce plain HTML, so the form works the same way regardless of which generator you use.

How do I add a form to a GitHub Pages site?

GitHub Pages only serves static files. Add a form that submits to a FormsList endpoint and it will work without any server-side code. Deploy normally and submissions are handled externally.

Ready to collect form submissions?

200 free submissions a month and a live endpoint in 30 seconds. No server, no credit card, just point your form at it.

Sign up with emailView pricing