Favorites

JavaScript TypedArray Object

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
TypedArray
JavaScript Indexed Collections · ConstructorThis object is supported by all modern browsers.
Updated 28th November 2026

Typed arrays, such as Uint8Array and Float32Array, are array-like views of raw binary data where every element has the same numeric type. They are used for files, images, audio, WebGL and network data.

Description

Typed arrays are array-like objects for working with raw binary data. TypedArray isn't a global you use directly; it is the shared parent of eleven concrete types: Int8Array, Uint8Array, Uint8ClampedArray, Int16Array, Uint16Array, Int32Array, Uint32Array, Float32Array, Float64Array, BigInt64Array and BigUint64Array (plus Float16Array in newer browsers). Every element has the same type and size, and values are converted to fit, so new Uint8Array([300]) stores 44.

A typed array is a view on an ArrayBuffer, and several views can share the same memory. They have most array methods, such as map(), slice() and includes(), but have a fixed length. They are used by the Canvas, WebGL, Web Audio, fetch() (via arrayBuffer()), file reading and WebSockets.

Unlike regular arrays, typed arrays can't grow or shrink, and assigning a value of the wrong type converts it rather than storing it as is. subarray() creates a new view over part of the same memory without copying, whereas slice() copies. Use Array.from(typed) or spread syntax to convert one to a normal array when you need to store mixed values.

Creating

new Uint8Array(length)
new Float32Array(array)
new Int16Array(buffer, byteOffset, length)

Example

const bytes = new Uint8Array([10, 255, 300]);
console.log(bytes);                 // 300 wraps around

const floats = new Float32Array(3);
floats[0] = 1.5;
console.log(floats, floats.length);

const buffer = new ArrayBuffer(4);
const view8 = new Uint8Array(buffer);
const view32 = new Uint32Array(buffer);
view32[0] = 1;
console.log(view8);                 // same memory

Browser Support

The following information will show you the current browser support for the TypedArray object. Hover over a browser icon to see the version that first introduced support for this object.

This object is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee