Atomics.isLockFree(size) answers a question about the engine, not about your data: for elements that are size bytes long, are the Atomics operations done with the CPU’s own atomic instructions (lock-free), or does the engine need an internal lock to fake them? It returns true or false and does not take a typed array at all. The rules are simple: isLockFree(4) is always true, sizes 1, 2, and 8 depend on the engine and the hardware (they are usually true on today’s computers), and every other size is false. Your Atomics code works either way; the answer only matters for advanced performance tuning.
Remember
Atomics.isLockFree(size) -> true or false
isLockFree(4) -> always true (Int32Array, Uint32Array)
isLockFree(1, 2, 8) -> engine and hardware decide
isLockFree(3, 16 ...) -> false
no typed array needed; nothing is read or written
Syntax
It takes one argument: a size in bytes.
JavaScript
Atomics.isLockFree(size)
Call
What it does
Atomics.isLockFree(size)
Returns true when atomic operations on size-byte elements are lock-free on this engine, otherwise false.
Atomics.isLockFree(Int32Array.BYTES_PER_ELEMENT)
Ask about a typed array type by passing its element size: 1 for Int8Array, 2 for Int16Array, 4 for Int32Array, 8 for BigInt64Array.
Available since ES2017. It is the only Atomics method that never touches a typed array.
Library declarations
JavaScript
Atomics.isLockFree(size) // returns a boolean
// size is converted to a number first; pass whole numbers
// 4 -> true on every engine
// 1, 2, 8 -> implementation-defined
// any other -> false
Parameters
Parameter
Description
size
Required. An element size in bytes. It is converted to a number, so "4" counts as 4, and null or a missing argument count as 0. Pass whole numbers: for a fraction such as 4.9, engines do not all give the same answer (Node.js 24 says false).
Return Value
Return Value
Description
true
Operations on elements of this size use hardware atomic instructions.
false
The size is not lock-free here, or it is not a size any integer typed array uses (for example 3 or 16).
JavaScript Examples
Example 1 — The Answers Every Engine Agrees On
Size 4 is always lock-free. Sizes that no integer typed array uses are always reported as not lock-free.
Strings become numbers."4" is converted to 4, so the answer is true.
Empty values count as 0.null and a missing argument both become 0, and no element is 0 bytes long, so both are false.
Stick to whole, positive sizes. -4 is not a valid size, so it is false. Fractions such as 4.9 are best avoided: engines do not all agree on them.
Compatibility
Browser & Runtime Support
Atomics.isLockFree() is part of ES2017. It needs no SharedArrayBuffer, so it runs on any page.
✓ Baseline · ES2017
Atomics.isLockFree()
Available in all modern browsers and in Node.js, Deno, and Bun. The answers for sizes 1, 2, and 8 are engine and hardware dependent.
95%Modern browser support
Google ChromeModern versions · Desktop & Mobile
Full support
Mozilla FirefoxModern versions · Desktop & Mobile
Full support
Apple SafariModern versions · macOS & iOS
Full support
Microsoft EdgeModern versions · Chromium
Full support
OperaModern versions
Full support
Samsung InternetModern versions · Android
Full support
Internet ExplorerNo Atomics object
Not supported
Node.jsCurrent releases · checked on Node 24
Supported
DenoCurrent releases
Supported
BunCurrent releases
Supported
Atomics.isLockFree()Excellent
Bottom line: Calling it is safe everywhere, including normal (not cross-origin isolated) browser tabs. Treat every answer except the one for size 4 as information, not as a guarantee.
Frequently Asked Questions
Whether atomic operations on elements of the given byte size are done directly by the hardware on this engine. It does not look at any data.
Yes. The language requires it, which is one reason Int32Array is the usual choice for shared counters and for Atomics.wait() and Atomics.notify().
Those answers are left to the engine. They depend on the CPU and on how the engine was built, so they can change between platforms.
No. They are still atomic; the engine just uses an internal lock to make them so, which can be slower.
No. It takes only a number, so it works on any page and in any runtime that has the Atomics object.