Favorites

JavaScript structuredClone() Function

☕
Enjoying this site?

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

Buy us a coffee
structuredClone()
JavaScript Global functionThis function is supported by all modern browsers.
Updated 28th November 2026

The structuredClone() function makes a deep copy of a value, including nested objects, arrays, dates, maps and sets.

Description

The structuredClone() function creates a deep copy of a value using the structured clone algorithm, the same one used to send data to web workers. Nested objects and arrays are copied rather than shared, and it supports types that JSON can't handle, such as Date, Map, Set, typed arrays and circular references.

It can't copy functions, DOM nodes or class instances' prototypes (they become plain objects), and throws a DataCloneError for unsupported values. It's provided by browsers and Node.js rather than by the JavaScript language itself.

Clones can also transfer objects such as ArrayBuffers with the transfer option, moving them into the copy instead of duplicating them, which is faster for large binary data. Getters aren't preserved: their current values are copied as plain properties. For simple JSON-compatible data, JSON.parse(JSON.stringify(x)) also works, but structuredClone() is clearer and handles more types.

Syntax

structuredClone(value)
structuredClone(value, { transfer })

Parameters

  • valueThe value to copy.
  • transferOptional. An array of transferable objects, such as ArrayBuffers, to move rather than copy.

Return Value

A deep copy of the value.

Exceptions

  • DataCloneErrorThrown if the value contains something that can't be cloned, such as a function.

Example

const original = { name: 'Sam', tags: ['a'], joined: new Date(0), seen: new Set([1]) };
const copy = structuredClone(original);
copy.tags.push('b');
console.log(original.tags, copy.tags);
console.log(copy.joined instanceof Date, copy.seen);

Browser Support

The following information will show you the current browser support for the structuredClone() function. Hover over a browser icon to see the version that first introduced support for this function.

This function 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