Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.
Note: This feature is available in Web Workers.
The DOMMatrixReadOnly() constructor creates a new DOMMatrixReadOnly object which represents a 4x4 matrix, suitable for 2D and 3D operations.
A string representing a 2D or 3D matrix in CSS matrix() or matrix3d() format.
initArray OptionalAn array containing either 6 or 16 numbers in column-major order. Other array lengths throw a TypeError.
If this argument is omitted, an identity matrix is created, i.e., equivalent to [1, 0, 0, 1, 0, 0].
If this argument is provided as a Float32Array or Float64Array, consider using the more performant static methods DOMMatrixReadOnly.fromFloat32Array() or DOMMatrixReadOnly.fromFloat64Array() instead.
A new DOMMatrixReadOnly object.
Thrown if the argument is not a string or an array with a length other than 6 or 16.
SyntaxErrorThrown if the string argument is not in a valid CSS matrix() or matrix3d() format.
| Geometry Interfaces Module Level 1 # dom-dommatrixreadonly-dommatrixreadonly |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Oct 27, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.