Do ArrayBuffers have a maximum length?

That only depends on your system and there doesn't seems to be a limit.

According to the specification :

If the requested number of bytes could not be allocated an exception is raised.


what would be the safe maximum Blob size to put on it

There does not seem to be a hard limit, just whatever restrictions your platform imposes.

However, if one uses some sort of indexed access, indexes shouldn't be greater than Number.MAX_SAFE_INTEGER, because interesting bugs would happen otherwise.

Luckily, 2^53-1 bytes is around 8 petabytes so it shuoldn't be a concern unless you are doing something really weird.


Here's an updated answer, at least according to Mozilla in July 2019:

The length property of an Array or an ArrayBuffer is represented with an unsigned 32-bit integer, that can only store values which are in the range from 0 to (2^32)-1.

(from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_array_length)

More details as of 2020-01-09:

Firefox seems to limit the size of the underlying buffer (so the limit is the number of bytes) whereas Chrome seems to limit the number of elements in a typed array. Also, Firefox's limit seems to be lower than what the mozilla link I posted says - according to the the link this

new ArrayBuffer(Math.pow(2, 32) - 1)

is a "valid case" but it throws a RangeError when run in the console (Firefox 72.0.1 64 bit on Windows 10)