Skip to content

Numeric Separator

In one line

Numeric separators (underscores) let you group digits in number literals for readability without changing the value.

In simple words

Numeric separators let you put underscores between digits in numeric literals to group them for readability. The underscores are ignored by the engine — 1_000_000 is exactly the same as 1000000. This makes large numbers much easier to read and verify.

Common uses: grouping thousands in money (1_000_000), grouping hex bytes (0xFF_FF_FF_FF), grouping binary bits (0b1010_1010), and separating credit card or account numbers. You can use multiple underscores and place them anywhere between digits, but not at the start/end or next to a decimal point or exponent.

This is purely a readability feature — the compiled value is identical. It was added in ES2021 and is supported in all modern browsers and Node.js 16+.

Example

javascript
const million = 1_000_000;
const bytes = 0xff_ff_ff_ff;
const bits = 0b1010_1010_1010;
const price = 1_299.99;

console.log(million); // 1000000
console.log(bytes);   // 4294967295
console.log(bits);    // 2730
console.log(price);   // 1299.99

Underscores group digits for humans. The engine ignores them — the values are identical to writing digits without separators.

Related terms

Related Resources

Related Lessons

Decode error messages

Plain-English explanations of common errors — what they mean, why they happen, and how to fix them.

View errors

← Back to glossary