Host // GitHub Pages

GitHub Pages contact form, no server needed

GitHub Pages is a pure static host: it serves your HTML, CSS, and JS and nothing else: there’s no PHP, no Node, no place to run a mailer or a spam check. So the usual server-side contact-form recipe simply can’t exist here. The clean answer is to let the form POST to an endpoint that lives off your site and does the receiving for you.

The short answer

GitHub Pages only serves static files. It can’t run any server-side code, so a form has nothing on the host to receive it. That makes a form endpoint the canonical fix: set a plain HTML form’s action to a MakeTheForm endpoint, and it catches the POST, filters spam, emails you, and stores every submission. No JavaScript needed.

The minimal integration

Paste this into any .html file in your GitHub Pages repo. It’s a normal form whose action is your endpoint: no build step, no JavaScript, no Jekyll plugin. On submit, the visitor lands on a branded success page you can redirect in settings.

HTML
<form action="https://mtform.co/f/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" required></textarea>
  </label>

  <!-- Spam trap: hidden from people, tempting to bots. Leave it empty. -->
  <input
    type="text"
    name="_mtf_honeypot"
    tabindex="-1"
    autocomplete="off"
    aria-hidden="true"
    style="position:absolute;left:-9999px"
  >

  <button type="submit">Send</button>
</form>

Replace your existing <form> tag, or just change its action attribute. The browser navigates to a branded success page. Configure a redirect in Settings.

Step by step

  1. 01

    Create the endpoint

    Create a MakeTheForm form to get your public endpoint URL and inbox.

  2. 02

    Add the form to your page

    In any HTML file in your repo, set the <form> action to the endpoint and method to POST, and include the _mtf_honeypot field.

  3. 03

    Commit and let Pages deploy

    Push to the branch GitHub Pages serves. No plugin or Action is needed. It’s plain static HTML.

  4. 04

    Verify and test

    Verify your recipient email once, open the live Pages URL, and submit to confirm it reaches your inbox and email.

Common pitfalls

Hunting for a server-side option that isn’t there

There’s no PHP mailer, no serverless function, no ‘form handler’ setting on GitHub Pages. The platform runs zero server code by design. An external endpoint isn’t a compromise here; it’s the only architecture that can work.

Skipping the honeypot on a public repo

GitHub Pages sites are indexed and often open-source, so bots find the form fast. Include the hidden _mtf_honeypot input. It’s the zero-JS spam trap. Leave it empty, and never make it required or display:none.

Troubleshooting

Troubleshooting by error code
SymptomWhat is happeningFix
404 on submitThe action points at a repo path instead of the full endpoint URL.Use the absolute https:// endpoint URL as the form action. GitHub Pages can’t process a relative form path.
no success pageThe form submitted but you expected to stay on your own site.A plain form navigates to the endpoint’s success page; set a custom redirect back to your site in settings.
403Allowed-domains is on and your github.io or custom domain isn’t listed.Add your Pages domain in the form’s spam settings, or leave the form public.

Frequently asked questions

Can you add a contact form to a GitHub Pages site?

Yes. GitHub Pages can’t process forms itself, but a plain HTML form can POST to an external endpoint that can. Set the form’s action to the endpoint and you get email delivery, spam filtering, and stored submissions with no server.

How do I handle form submissions on a static site with no server?

Send them to a hosted form endpoint. The static page holds the form; the endpoint, running off your site, receives the POST, filters spam, emails you, and stores each submission. No backend code lives in your repo.

Do I need JavaScript for a GitHub Pages contact form?

No. A plain HTML form with an action and method POST works with zero JavaScript. Add a small fetch script only if you want an inline success message instead of navigating to the endpoint’s success page.

Ship this form for real

Create an endpoint, paste it in, and watch the first submission land in your inbox, in under three minutes.

Create free endpoint