In JavaScript, a typed array is an array-like list of numbers that all have the same numeric type, for example only 8-bit unsigned integers (Uint8Array) or only 32-bit floating-point numbers (Float32Array). You read and write it with indexes, just like a normal array: bytes[0], bytes.length.
Under the hood a typed array is a view over an ArrayBuffer, a block of raw bytes. The buffer stores the bytes; the typed array decides how to read them as numbers. Its length is fixed when you create it, and every new element starts at 0.
You meet typed arrays whenever JavaScript handles binary data: file and network bytes, canvas pixels (ImageData.data is a Uint8ClampedArray), Web Audio samples (Float32Array), and WebGL buffers. This page teaches the ideas; the TypedArray Methods index lists all 34 method guides (TypedArray.from(), subarray(), sort(), and more).
Typed array = one number type + fixed length + shared bytes.
Print a typed array with ta.join(' ') or Array.from(ta).join(', '). Browsers and Node.js format console.log(ta) differently, so the examples on this site always turn it into text first.
Syntax
JavaScript Syntax
Common ways to create a typed array:
JavaScript
const zeros = new Uint8Array(4); // 4 elements, all 0
const fromList = new Int16Array([5, -2, 300]); // copy numbers in
const view = new Float32Array(buffer, 8, 2); // view 2 floats of an existing buffer
const mapped = Uint8Array.from('123', Number); // TypedArray.from()
const listed = Int32Array.of(7, 8, 9); // TypedArray.of()
zeros.length; // 4 (elements)
fromList.byteLength; // 6 (3 elements x 2 bytes)
Int16Array.BYTES_PER_ELEMENT; // 2
Reference
The 11 Typed Array Types
Pick the type by the kind of number you need to store. Each element uses BYTES_PER_ELEMENT bytes.
Type
Bytes per element
Value range
Typical use
Int8Array
1
-128 to 127
Small signed numbers
Uint8Array
1
0 to 255
Raw bytes: files, network data
Uint8ClampedArray
1
0 to 255 (clamped)
Canvas pixel colors
Int16Array
2
-32,768 to 32,767
16-bit audio samples
Uint16Array
2
0 to 65,535
Counts, character codes
Int32Array
4
about -2.1 billion to 2.1 billion
Large whole numbers
Uint32Array
4
0 to about 4.29 billion
IDs, colors as 0xRRGGBBAA
Float32Array
4
about ±3.4 × 1038, about 7 digits
Graphics (WebGL), Web Audio
Float64Array
8
same as a normal JavaScript number
Precise decimal math
BigInt64Array
8
-263 to 263 - 1 (BigInt)
64-bit signed integers
BigUint64Array
8
0 to 264 - 1 (BigInt)
64-bit unsigned integers
A twelfth type, Float16Array (half-precision floats), was added in ES2025. It is still new, so this tutorial sticks to the 11 long-standing types.
Values
How Values Are Stored
A typed array never stores a value as you wrote it if that value does not fit the type. It converts it instead, without an error:
Integer types wrap around. In a Uint8Array, 256 becomes 0 and -1 becomes 255. Decimals are cut off: 9.9 becomes 9.
Uint8ClampedArray clamps.300 becomes 255 and -5 becomes 0. Decimals are rounded, with halves going to the even number (2.5 becomes 2).
Float32Array rounds to single precision.0.1 is read back as 0.10000000149011612. Use Float64Array for the same precision as normal JavaScript numbers.
BigInt types only take BigInts.new BigInt64Array([1]) throws a TypeError; write [1n].
Compare
Typed Array vs Normal Array
Question
Normal Array
Typed array
What can it hold?
Any values, mixed: numbers, strings, objects
Only numbers of one type (BigInts for the BigInt types)
Can the length change?
Yes: push(), pop(), splice()
No: the length is fixed when it is created
Empty slots?
Can have holes
No holes; new elements start at 0
Where is the data?
Managed by the engine
Packed bytes in an ArrayBuffer (ta.buffer)
Default sort()
Compares as strings: [10, 9, 100] becomes 10, 100, 9
Compares as numbers: 9, 10, 100
map() / filter() return
A new Array
A new typed array of the same type
Wrong value written
Stored as it is
Converted: wraps, clamps, or rounds
Array.isArray()
true
false
One exception to the fixed length: a typed array created on a resizable buffer without a length follows the buffer's size (see ArrayBuffer resize()).
Behind the scenes
The Hidden TypedArray Class
All 11 types inherit their methods from one parent class called TypedArray. It is not a global: typeof TypedArray is "undefined", and you can only reach it with Object.getPrototypeOf(Int8Array). That is why method names on this site are written as TypedArray.from() or TypedArray.prototype.map(), while your code calls Uint8Array.from() or scores.map() on a real type.
Typed arrays are not arrays: Array.isArray(new Uint8Array(2)) is false. When you need array-only methods such as push(), convert first with Array.from(ta) or [...ta].
Code
JavaScript Examples
Three short programs that show what makes typed arrays different.
Example 1 — Create a Typed Array and Inspect It
Make a Uint8Array from a list of numbers, then read its length, its size in bytes, and its elements.
Uint8Array wraps around. Only 0 to 255 fits in one byte, so 256 turns into 0, -1 into 255, and 300 into 44 (300 minus 256).
Uint8ClampedArray stops at the edges. The clamped type pins anything above 255 to 255 and anything below 0 to 0, which is exactly what pixel colors need.
Float32Array loses precision. A 32-bit float cannot hold 0.1 exactly. Reading it back gives the nearest single-precision value, so the comparison with 0.1 is false.
Example 3 — Two Typed Arrays on One Buffer
A typed array can cover only part of an ArrayBuffer. Two views on the same bytes see each other's changes.
A typed array is an array-like list of numbers that all share one numeric type, such as Uint8Array for bytes or Float32Array for 32-bit floats. It has a fixed length and stores its numbers as raw bytes in an ArrayBuffer.
Not directly. TypedArray is the hidden parent class of the 11 types and is not a global, so typeof TypedArray is "undefined". You always use a real type: new Uint8Array(4), Uint8Array.from(list), or Int16Array.of(1, 2).
Its length is fixed when you create it, so push(), pop(), splice(), and concat() do not exist. Create a new, bigger typed array and copy the old values in with set(), or convert to a normal array with Array.from().
Uint8Array for raw bytes from files or the network, Uint8ClampedArray for canvas pixels, Int16Array or Float32Array for audio samples, Float32Array for WebGL, Float64Array for precise decimals, and BigInt64Array for 64-bit integers.
An ArrayBuffer only holds raw bytes and has no indexes. A typed array is a view that reads those bytes as numbers. new Uint8Array(4) creates both at once: a 4-byte buffer (ta.buffer) and a view on it.