Prompt max length

Here are some real world numbers in case anyone is interested. Please add more if you have any.

Using the following code in the browser console:

s = prompt("a", Array(SOME_NUMBER).join("0")); s.length;

  • Chrome 43 - 2000 with ellipses as mentioned by @Redzarf.
  • Firefox 39 - Reached 10,000,000 then stopped testing (browser runs slowly while this is executing. You may get the 'non responsive script' alert as well).
  • IE 11 - Reached 10,000,000 then stopped testing.

The ECMAScript Programming Language Specification does not specify any maximum length. The maximum length with will be implementation-specific i.e, based on available memory.


As an example, Chrome (v41) limits the 2nd param for prompt() to 2000 characters.

If the value given is longer than that it truncates these 3 strings:

first 999 char
'...'
last 998 char