Skip to content
Latest: Publish JavaScript Packages to NPM Like a Pro!

Math.ceil() Method in JS – How to Round Up Numbers

Whenever you invoke Math.ceil(), the method rounds up its argument to the nearest integer.

Math.ceil() accepts only one argument. Here is the syntax:

Math.ceil(value);

The value argument represents the number you wish to round up to the nearest integer.

Below are examples of the Math.ceil() method.

Math.ceil(9);
// The invocation above will return: 9

Try it on StackBlitz

Math.ceil(9.999);
// The invocation above will return: 10

Try it on StackBlitz

Math.ceil(-9.999);
// The invocation above will return: -9

Try it on StackBlitz

The snippet above returned -9 because -9 is the integer directly above -9.999 on the number line. In other words, -9 is greater than -9.999. But -10 is less than -9.999.

Math.ceil(0.91);
// The invocation above will return: 1

Try it on StackBlitz

Math.ceil(0.01);
// The invocation above will return: 1

Try it on StackBlitz

Math.ceil(0);
// The invocation above will return: 0

Try it on StackBlitz