Copy an object from the console with copy
Send any value from the DevTools console to your clipboard with copy, as formatted JSON, without selecting text by hand. Chrome and Firefox.
Right-clicking and copying a large object from the console is clumsy and often gives a truncated string. The copy command puts the full value on the clipboard.
copy(JSON.stringify(window.__DATA__, null, 2));undefinedThe command returns nothing, so the console prints undefined, and the clipboard now holds the formatted JSON. Paste it into an editor or an issue. It also takes strings directly: copy($0.outerHTML) copies the selected element's markup. See the Console Utilities reference.
copy converts objects with JSON.stringify-like logic when you pass one, but passing the result of JSON.stringify yourself, as above, lets you control the indentation and drop circular references first.
Like the other console commands, it only exists inside DevTools. A page script calling copy() fails with a ReferenceError, and in the page the standard way is navigator.clipboard.writeText, which needs a secure context and a user gesture.
Do not copy values that hold secrets, such as session tokens, into places that sync across devices.