Free tool

HTML Form Generator

Pick a template, edit the fields and copy plain HTML and CSS. The code works on any site, from a static page to WordPress, and you never need an account.

  • No signup
  • No JavaScript
  • Accessible markup
  • Spam trap included

Start from a template

  1. More settings
  2. More settings
  3. More settings
  4. More settings

Live preview

Submitting is turned off in the preview

4.0 KB · no JavaScript
<!-- Form built with the free HTML form generator at https://widgetjar.com/tools/html-form-generator -->
<style>
.wj-form {
  --wjf-accent: #4f46e5;
  --wjf-accent-text: #ffffff;
  --wjf-radius: 8px;
  --wjf-bg: #ffffff;
  --wjf-text: #0f172a;
  --wjf-muted: #475569;
  --wjf-border: #cbd5e1;
  --wjf-field: #ffffff;
  --wjf-error: #b91c1c;
  box-sizing: border-box;
  max-width: 600px;
  margin: 0 auto;
  padding: 28px;
  background: var(--wjf-bg);
  color: var(--wjf-text);
  border: 1px solid var(--wjf-border);
  border-radius: calc(var(--wjf-radius) * 1.5);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wj-form *, .wj-form *::before, .wj-form *::after { box-sizing: inherit; }
.wj-form h2 { margin: 0 0 6px; font-size: 1.375rem; line-height: 1.3; }
.wj-form .wjf-intro { margin: 0 0 20px; color: var(--wjf-muted); }
.wj-form .wjf-grid { display: flex; flex-wrap: wrap; gap: 18px 16px; }
.wj-form .wjf-field { flex: 1 1 100%; min-width: 0; margin: 0; padding: 0; border: 0; }
.wj-form .wjf-half { flex: 1 1 220px; }
.wj-form label, .wj-form legend { display: block; margin: 0 0 6px; padding: 0; font-weight: 600; font-size: 0.9375rem; }
.wj-form .wjf-req { color: var(--wjf-error); }
.wj-form input:not([type="checkbox"]):not([type="radio"]),
.wj-form select,
.wj-form textarea {
  display: block;
  width: 100%;
  padding: 10px 12px;
  font: inherit;
  color: inherit;
  background: var(--wjf-field);
  border: 1px solid var(--wjf-border);
  border-radius: var(--wjf-radius);
}
.wj-form textarea { min-height: 120px; resize: vertical; }
.wj-form input[type="file"] { padding: 8px; }
.wj-form ::placeholder { color: var(--wjf-muted); opacity: 1; }
.wj-form :focus-visible { outline: 2px solid var(--wjf-accent); outline-offset: 2px; }
.wj-form :user-invalid { border-color: var(--wjf-error); }
.wj-form .wjf-help { margin: 6px 0 0; font-size: 0.875rem; color: var(--wjf-muted); }
.wj-form .wjf-choice { display: flex; align-items: flex-start; gap: 10px; margin: 8px 0 0; font-weight: 400; }
.wj-form input[type="checkbox"], .wj-form input[type="radio"] {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  accent-color: var(--wjf-accent);
}
.wj-form button {
  width: 100%;
  margin-top: 22px;
  padding: 12px 20px;
  font: inherit;
  font-weight: 600;
  color: var(--wjf-accent-text);
  background: var(--wjf-accent);
  border: 0;
  border-radius: var(--wjf-radius);
  cursor: pointer;
}
.wj-form button:hover { filter: brightness(1.08); }
.wj-form .wjf-hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
</style>
<form class="wj-form" action="https://example.com/your-form-handler" method="post">
  <h2>Contact us</h2>
  <p class="wjf-intro">Send us a message and we will get back to you within one business day.</p>
  <!-- Spam trap: people never see this field. Reject submissions where it is filled in. -->
  <div class="wjf-hp" aria-hidden="true">
    <label>Leave this empty <input type="text" name="company_website" tabindex="-1" autocomplete="off"></label>
  </div>
  <div class="wjf-grid">
    <div class="wjf-field wjf-half">
      <label for="wjf-name-1">Full name <span class="wjf-req" aria-hidden="true">*</span></label>
      <input type="text" id="wjf-name-1" name="name" autocomplete="name" required>
    </div>
    <div class="wjf-field wjf-half">
      <label for="wjf-email-2">Email <span class="wjf-req" aria-hidden="true">*</span></label>
      <input type="email" id="wjf-email-2" name="email" autocomplete="email" required>
    </div>
    <div class="wjf-field">
      <label for="wjf-phone-3">Phone</label>
      <input type="tel" id="wjf-phone-3" name="phone" autocomplete="tel" aria-describedby="wjf-phone-3-help">
      <p class="wjf-help" id="wjf-phone-3-help">Optional. Only if you prefer a call.</p>
    </div>
    <div class="wjf-field">
      <label for="wjf-message-4">Message <span class="wjf-req" aria-hidden="true">*</span></label>
      <textarea id="wjf-message-4" name="message" required rows="5"></textarea>
    </div>
  </div>
  <button type="submit">Send message</button>
</form>

How to add the form to your website

  1. Build it. Start from a template, rename the fields, and mark the ones people must fill in. Half-width fields sit side by side on wide screens and stack on phones.
  2. Choose a destination. HTML only collects the answers. Under Destination, enter the URL that receives them, switch to Netlify Forms, or use mailto: for internal pages.
  3. Copy and paste. Copy the snippet into your page where the form should appear, or download a complete .html file. Then send yourself a test submission.

What the generated code does for you

  • Labels people and screen readers can use. Each input has a visible label tied to it with for and id, radio and checkbox groups sit in a fieldset with a legend, and help text is announced through aria-describedby.
  • Faster filling on phones. Email, phone, name, company and address fields get the right type and autocomplete token, so mobile keyboards and browser autofill work.
  • Validation without scripts. Required fields use the browser’s own checks, and :user-invalid marks a field red only after someone has interacted with it.
  • A spam trap. The optional honeypot catches simple bots without a CAPTCHA.
  • CSS that stays in its lane. Every rule is scoped to .wj-form, and colors and corners are custom properties you can change in one place.

Where to send form submissions

OptionGood forWatch out for
Your own server scriptFull control over storage and emailYou validate input, block spam and keep it running
Serverless functionStatic sites on Vercel, Cloudflare or AWSYou still write the email or storage step
Netlify FormsSites already hosted on NetlifyFree tier submission limits; only works on Netlify
Hosted form backendAny static site, no codeMost need an account and an endpoint key
mailto:Quick internal formsNeeds an email app on the visitor’s device; no files

If you would rather not run any backend, the WidgetJar form builder widget stores entries, sends email notifications and passes submissions to tools like Google Sheets, Slack and Zapier. It adds a script to your page, which this generator never does.

Related guides

Frequently Asked Questions

Common questions about generated HTML forms, submissions and spam.

  • Yes. There is no account, no email gate and no usage limit. The code runs in your browser and is yours to use on any site, commercial or not. The only branding is one HTML comment at the top of the snippet, which you can delete.