Favorites

JavaScript / Division Operator

☕
Enjoying this site?

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

Buy us a coffee
/
JavaScript Arithmetic OperatorThis operator is supported by all modern browsers.
Updated 28th November 2026

The division operator (/) divides one number by another. Dividing by zero gives Infinity rather than an error.

Description

The division operator / divides the left operand by the right. JavaScript has no separate integer division: 7 / 2 is 3.5, so use Math.trunc() or Math.floor() for a whole-number result. Dividing a non-zero number by zero gives Infinity or -Infinity, and 0 / 0 gives NaN; neither throws an error. With BigInts, division rounds towards zero.

Division follows the usual floating point rules, so some results can't be represented exactly: 1 / 3 is 0.3333333333333333. When displaying results, format them with toFixed() or Intl.NumberFormat. To check whether one number divides evenly into another, use the remainder operator: a % b === 0. Division and multiplication have the same precedence and are evaluated left to right, so 8 / 2 * 4 is 16.

Operands are converted to numbers first, so '10' / '4' is 2.5, and values that can't be converted give NaN. Dividing BigInts gives a BigInt, discarding any remainder, and dividing a BigInt by 0n throws a RangeError instead of returning Infinity. The compound form x /= y divides a variable in place.

Properties

Operator
/
Category
Arithmetic
Precedence
12 (1 is lowest, 18 is highest)
Associativity
left-to-right

Syntax

x / y

Example

console.log(7 / 2);
console.log(Math.trunc(7 / 2));
console.log(5 / 0, -5 / 0, 0 / 0);
console.log(7n / 2n);

Browser Support

The following information will show you the current browser support for the / operator. Hover over a browser icon to see the version that first introduced support for this operator.

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