Syntax
<textarea name="message" rows="4" cols="50">Default text</textarea>Examples
Basic Textarea
A simple multi-line text field.
<label for="msg">Message:</label>
<textarea id="msg" name="message" rows="5" placeholder="Type your message here..."></textarea>Textarea with Character Limit
Restricting input length with maxlength.
<textarea name="bio" maxlength="200" rows="4" placeholder="Tell us about yourself (200 characters max)"></textarea>Non-resizable Styled Textarea
Preventing resizing and applying custom styles.
<textarea rows="6" style="width: 100%; resize: none; padding: 10px; border-radius: 8px; border: 1px solid #d1d5db; font-family: inherit;" placeholder="Write a review..."></textarea>Attributes
- rows (number): The visible number of text lines
- cols (number): The visible width in average character widths
- maxlength (number): The maximum number of characters allowed
- placeholder (string): Hint text shown when empty
- required (boolean): Marks the field as mandatory
Best practices
- Set sensible default rows so the field looks appropriately sized before the user starts typing
- Use the CSS resize property to control whether users can resize the textarea, rather than removing the ability entirely
- Pair with a <label>, same as any other form field
- Consider maxlength with a visible character counter for fields like bios or reviews
Browser compatibility
Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.
<textarea>
Desktop
- Chrome
- Supported
From 1 - Firefox
- Supported
From 1 - Safari
- Supported
By 4 (possibly earlier) - Edge
- Supported
From 12 - Opera
- Supported
By 12.1 (possibly earlier)
Mobile
- Safari on iOS
- Supported
By 3 (possibly earlier) - Chrome for Android
- Supported
From 18 - Firefox for Android
- Supported
From 4 - Samsung Internet
- Supported
From 1.0
MDN BCD record for this feature · MDN reference
Support history and limitations
Chrome
- From 1
Firefox
- From 1 · Before Firefox 6, when a <textarea> was focused, the insertion point was placed at the end of the text by default. Other major browsers place the insertion point at the beginning of the text. · A default background-image gradient is applied to all <textarea> elements, which can be disabled using background-image: none. · Before Firefox 89, manipulating the content of <textarea> elements using Document.execCommand() commands requires workarounds (see bug 1220696).
Safari
- By 4 (possibly earlier)
Edge
- From 12
Opera
- By 12.1 (possibly earlier)
Safari on iOS
- By 3 (possibly earlier) · Unlike other major browsers, a default style of opacity: 0.4 is applied to disabled <textarea> elements.
Chrome for Android
- From 18
Firefox for Android
- From 4 · Before Firefox for Android 6, when a <textarea> was focused, the insertion point was placed at the end of the text by default. Other major browsers place the insertion point at the beginning of the text. · A default background-image gradient is applied to all <textarea> elements, which can be disabled using background-image: none. · Before Firefox for Android 89, manipulating the content of <textarea> elements using Document.execCommand() commands requires workarounds (see bug 1220696).
Samsung Internet
- From 1.0
<textarea> rows
Desktop
- Chrome
- Supported
From 1 - Firefox
- Supported
From 1 - Safari
- Supported
By 4 (possibly earlier) - Edge
- Supported
From 12 - Opera
- Supported
By 12.1 (possibly earlier)
Mobile
- Safari on iOS
- Supported
By 3.2 (possibly earlier) - Chrome for Android
- Supported
From 18 - Firefox for Android
- Supported
From 4 - Samsung Internet
- Supported
From 1.0
MDN BCD record for this feature
Support history and limitations
Chrome
- From 1
Firefox
- From 1
Safari
- By 4 (possibly earlier)
Edge
- From 12
Opera
- By 12.1 (possibly earlier)
Safari on iOS
- By 3.2 (possibly earlier)
Chrome for Android
- From 18
Firefox for Android
- From 4
Samsung Internet
- From 1.0
<textarea> cols
Desktop
- Chrome
- Supported
From 1 - Firefox
- Supported
From 1 - Safari
- Supported
By 4 (possibly earlier) - Edge
- Supported
From 12 - Opera
- Supported
By 12.1 (possibly earlier)
Mobile
- Safari on iOS
- Supported
By 3.2 (possibly earlier) - Chrome for Android
- Supported
From 18 - Firefox for Android
- Supported
From 4 - Samsung Internet
- Supported
From 1.0
MDN BCD record for this feature
Support history and limitations
Chrome
- From 1
Firefox
- From 1
Safari
- By 4 (possibly earlier)
Edge
- From 12
Opera
- By 12.1 (possibly earlier)
Safari on iOS
- By 3.2 (possibly earlier)
Chrome for Android
- From 18
Firefox for Android
- From 4
Samsung Internet
- From 1.0
<textarea> maxlength
Desktop
- Chrome
- Supported
From 4 - Firefox
- Supported
From 4 - Safari
- Supported
From 5 - Edge
- Supported
From 12 - Opera
- Supported
By 12.1 (possibly earlier)
Mobile
- Safari on iOS
- Supported
From 4.2 - Chrome for Android
- Supported
From 18 - Firefox for Android
- Supported
From 4 - Samsung Internet
- Supported
From 1.0
MDN BCD record for this feature · MDN reference
Support history and limitations
Chrome
- From 4
Firefox
- From 4
Safari
- From 5 · Before Safari 17, newline characters counted as two characters instead of one. See bug 249916.
Edge
- From 12
Opera
- By 12.1 (possibly earlier)
Safari on iOS
- From 4.2 · Before Safari on iOS 17, newline characters counted as two characters instead of one. See bug 249916.
Chrome for Android
- From 18
Firefox for Android
- From 4
Samsung Internet
- From 1.0
<textarea> placeholder
Desktop
- Chrome
- Supported
From 4 - Firefox
- Supported
From 4 - Safari
- Supported
From 5 - Edge
- Supported
From 12 - Opera
- Supported
By 12.1 (possibly earlier)
Mobile
- Safari on iOS
- Supported
From 5 - Chrome for Android
- Supported
From 18 - Firefox for Android
- Supported
From 4 - Samsung Internet
- Supported
From 1.0
MDN BCD record for this feature · MDN reference
Support history and limitations
Chrome
- From 4
Firefox
- From 4
Safari
- From 5
Edge
- From 12
Opera
- By 12.1 (possibly earlier)
Safari on iOS
- From 5
Chrome for Android
- From 18
Firefox for Android
- From 4
Samsung Internet
- From 1.0
<textarea> required
Desktop
- Chrome
- Supported
From 4 - Firefox
- Supported
From 4 - Safari
- Supported
From 5 - Edge
- Supported
From 12 - Opera
- Supported
By 12.1 (possibly earlier)
Mobile
- Safari on iOS
- Supported
From 5 - Chrome for Android
- Supported
From 18 - Firefox for Android
- Supported
From 4 - Samsung Internet
- Supported
From 1.0
MDN BCD record for this feature · MDN reference
Support history and limitations
Chrome
- From 4
Firefox
- From 4
Safari
- From 5
Edge
- From 12
Opera
- By 12.1 (possibly earlier)
Safari on iOS
- From 5
Chrome for Android
- From 18
Firefox for Android
- From 4
Samsung Internet
- From 1.0
MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.