Skip to content Skip to sidebar Skip to footer

How Many Characters Are Possible In An Input Field In Html?

What is the 'natural' number of allowed characters in an input field in html? thanks a lot addition due to the comments i don't need to send it to the server via post or get. i am

Solution 1:

Firefox 3.6.6 on my 32 bit Win 7 machine becomes slow after 1,000,000 characters and totally freezes after 4,000,000.

Chrome crashes somewhere after 8,000,000.

IE8 crashes somewhere after 8,000,000.

Safari crashes somewhere after 2,000,000.

In my testing Chrome/IE8/Safari don't slow down as the size goes up the way Firefox does.

Solution 2:

When the type attribute has the value "text" or "password", this attribute specifies the maximum number of characters the user may enter. This number may exceed the specified size, in which case the user agent should offer a scrolling mechanism. The default value for this attribute is an unlimited number.

Source: http://www.w3.org/TR/html401/interact/forms.html#adef-maxlength

Solution 3:

I wouldn't think there is a limit, unless the code has something stopping it (size parameter) or the server can't take any more characters (either a LOT of characters or a bad server).

There is also the 32bit etc. limits depending on the server, I believe.

Solution 4:

I think that depends on the method you are sending the form with. If you send the form via GET-method it's only 255 chars for the whole query (correct me if I am wrong). The POST-method allows much more...

So in the end you can write millions of chars in a text-field, the question is, if all chars are sent to the server.

In HTML however you've got the possibility to specify how many characters you want to allow. Look at this snippet:

<inputtype="text" name="email" maxlength="255" />

The maxlength-attribute of the tag, prevents the user from being able to type in more than 255 chars.

Solution 5:

In a textarea you can enter an unlimited amount of text.

OK, in practice you shouldn't enter megabytes of text or you will run into server limits.

When you the POST method to send the form to the server (which is the usual way), then you can send at least megabytes. When you use the GET method, the whole form is transferred through the querystring and there the limits are in the thousands of characters (the exact value depends on the server and the browser).

Post a Comment for "How Many Characters Are Possible In An Input Field In Html?"