Generate contact form HTML code
Choose the fields your form needs, set the action, and copy the generated markup into your page. The output uses associated labels, native input types, and required attributes so it works without a JavaScript framework.
Use a POST action when a server or form backend will process submissions. Use mailto only for a quick prototype because it depends on the visitor having an email application configured.
The generator creates the form structure. Add your own CSS or target the included class names to match the surrounding website.
Connect the HTML form to email or a backend
A browser cannot send a reliable email from HTML alone. Point the form action at your own endpoint or a hosted form backend, then validate and sanitise every submitted value on the server.
Keep the method set to POST for personal data, show a clear success state, and return useful validation errors when a field is missing.
If you do not want to maintain a submission endpoint, build the form in LemForms and embed it on the same page.
Make a contact form accessible and spam-resistant
Keep every visible field label connected to its input, preserve a logical keyboard order, and make error messages specific to the field that needs attention.
Add a hidden honeypot and server-side rate limiting to reduce automated spam. Do not rely on client-side required attributes as the only validation layer.
Test the finished form with a keyboard and at a narrow mobile width before publishing it.
Frequently asked questions
Where do submissions go?
With the mailto: action they open the user's email client. For real server-side delivery, point the action at a form backend like LemForms.
Is the generated HTML accessible?
Yes — labels are correctly associated, required fields are marked, and the markup is keyboard-navigable.
Can I style it?
Yes. The output uses simple class names so any CSS framework (Tailwind, Bootstrap, your own) can target it.
Build the form behind the tool
LemForms is the form builder this tool plugs into — calculations, conditional logic, embeds, webhooks, and a real submissions dashboard. Free to start.
Try LemForms freeMore free tools
- Form Embed Code GeneratorPaste any form URL and get copy-paste embed code for WordPress, Webflow, Framer, Wix, Squarespace, Shopify, Notion and more.
- NPS Score CalculatorCalculate your Net Promoter Score in seconds. Enter promoters, passives, and detractors — get NPS, percentage breakdown, and industry context.
- CSAT Score CalculatorCalculate Customer Satisfaction Score (CSAT) instantly. Enter satisfied and total responses to get your CSAT percentage with the formula explained.
- Survey Sample Size CalculatorCalculate the minimum survey sample size for any population, confidence level, and margin of error. Free, no signup required.