HTML textarea in forms: practical guide with examples
Use a <textarea> when a single-line input is too small for the answer you need. Messages, feedback, support descriptions, job application notes, and project briefs all belong in a textarea.
The better question is not “how do I add a textarea?” It is “how do I collect useful long text without hurting usability, accessibility, or deliverability?” A production textarea needs a clear label, a useful size, sensible limits, and backend handling for long or abusive content.
Basic textarea form
<form action="https://api.formsfort.com/submit" method="POST"> <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY" />
<label for="message">Message</label> <textarea id="message" name="message" rows="5" required></textarea>
<input type="checkbox" name="botcheck" style="display:none" /> <button type="submit">Send message</button></form>The important attributes are:
| Attribute | Purpose |
|---|---|
id | Connects the textarea to a visible label |
name | Controls the submitted field name |
rows | Sets the initial visible height |
required | Prevents empty browser submissions |
Without name, the browser will not include the textarea value in the submitted form data.
Textarea vs input
Use a text input for short values. Use a textarea for longer free-form responses.
| Field | Best for |
|---|---|
<input type="text"> | Name, company, city, short answer |
<input type="email"> | Email address |
<input type="url"> | Website URL |
<textarea> | Message, feedback, description, notes |
Do not use a textarea for email addresses, phone numbers, dates, or prices. Specialized input types give users better mobile keyboards and browser validation.
Add useful limits
Long text is valuable, but unbounded text is a spam and storage risk. Set maxlength for the browser and enforce limits on the backend.
<label for="project">Project details</label><textarea id="project" name="project_details" rows="7" minlength="20" maxlength="3000" placeholder="Tell us what you are building, your timeline, and what should happen after submission." required></textarea>Use minlength only when a short answer would be unusable. For contact forms, required plus maxlength is usually enough.
Use placeholder text carefully
Placeholder text can show examples, but it should not replace the label. Placeholder text disappears as soon as the visitor starts typing and may be missed by assistive technology.
Good:
<label for="support_message">What happened?</label><textarea id="support_message" name="support_message" rows="6" placeholder="Include the page URL, error message, and what you expected to happen."></textarea>Poor:
<textarea placeholder="Message"></textarea>The poor version has no label and no name, so it is both less accessible and less useful to the backend.
Control resizing with CSS
Browsers often allow visitors to resize textareas. That is useful, but horizontal resizing can break narrow layouts.
textarea { width: 100%; min-height: 140px; resize: vertical;}resize: vertical lets visitors make the textarea taller without breaking the page width.
Submit textarea content to a backend
This complete example works on a static site and sends a structured submission to FormsFort.
<form action="https://api.formsfort.com/submit" method="POST"> <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY" /> <input type="hidden" name="subject" value="New support request" />
<label for="email">Email</label> <input type="email" id="email" name="email" autocomplete="email" required />
<label for="category">Category</label> <select id="category" name="category" required> <option value="">Choose a category</option> <option value="billing">Billing</option> <option value="technical">Technical issue</option> <option value="account">Account</option> </select>
<label for="message">Details</label> <textarea id="message" name="message" rows="7" maxlength="3000" required></textarea>
<input type="checkbox" name="botcheck" style="display:none" /> <button type="submit">Send request</button></form>When submitted, the backend receives email, category, and message as normal fields. That makes the submission easy to email, forward to a webhook, append to a sheet, or triage in a dashboard.
Security and spam notes
Textarea fields attract spam because they accept arbitrary text. Use a honeypot field, rate limits, domain restrictions, and optional CAPTCHA for exposed forms.
Never render submitted textarea content as raw HTML in an admin panel or email template. Escape user content before display. Even when your form is static, submitted text is untrusted input.
Related guides
See HTML form examples for copy-paste templates, HTML input fields for short fields, and honeypot vs CAPTCHA for spam protection.
Frequently asked questions
What is textarea used for in an HTML form?
Textarea is used for multi-line text, such as messages, comments, notes, support details, and project descriptions.
Does textarea need a name attribute?
Yes. The name attribute is the key submitted to your form backend. Without it, the textarea value is not included in standard form submission.
How do I limit textarea length?
Use maxlength for the browser-side limit and enforce a server-side maximum in your form backend.
Can textarea be required?
Yes. Add the required attribute to prevent empty submissions in browsers that support HTML5 validation.
Get started free
Ready to add forms to your static site?
No backend required. Point your HTML form at FormsFort and start receiving submissions in minutes.