Lodash _.floor() Method

Beginner
5 min read
Updated: Nov 2026
5 examples
Math

Definition

Computes number rounded down to precision. Part of Lodash 4.x Math (since 3.10.0).

Pass the numbers or collection shown below. Check the return value before you chain another math helper.

Syntax

Call _.floor. Start with this line.

Lodash
_.floor(number, [precision=0])
CallWhat it does
_.floor(number, [precision=0])Primary signature.

Prefer import floor from "lodash/floor" when you want a smaller bundle.

Library declarations
Lodash
_.floor(number, [precision=0])

Parameters

ParameterDescription
numberRequired. Value to round down (coerced with toNumber)
precisionOptional. Places to round to; default 0; capped at 292

Return Value

Return ValueDescription
*Rounded-down number (or NaN if input is not numeric)

Lodash Examples

Example 1 — Default Precision

Round down to the previous whole number.

Lodash
_.floor(4.006);
// → 4
Try It Yourself

How It Works

  1. Default. Omitted precision means 0.
  2. Down. Any fractional part is dropped toward −Infinity.
  3. Native. Same idea as Math.floor(4.006).
  4. Docs. Matches the first official example.

Example 2 — Decimal Precision

Keep two decimal places, still rounding down.

Lodash
_.floor(0.046, 2);
// → 0.04
Try It Yourself

How It Works

  1. Precision 2. Target is hundredths.
  2. Value. 0.046 sits between 0.04 and 0.05.
  3. Floor. Rounds down to 0.04 (not up to 0.05).
  4. Shift. Lodash uses exponential shifting to reduce float noise.

Example 3 — Negative Precision

Round down to the nearest hundred.

Lodash
_.floor(4060, -2);
// → 4000
Try It Yourself

How It Works

  1. −2. Means “nearest 10²” → nearest hundred.
  2. Between. 4060 sits between 4000 and 4100.
  3. Down. Floor chooses 4000.
  4. Tip. −1 → tens, −3 → thousands.

Example 4 — Negative Numbers

“Down” still means toward −Infinity.

Lodash
_.floor(-4.1);
// → -5
Try It Yourself

How It Works

  1. Number line. -5 is to the left of -4.1.
  2. Toward −∞. That is the floor direction.
  3. Contrast. _.ceil(-4.1) → -4.
  4. Trap. “Toward zero” is not what floor means for negatives.

Example 5 — floor vs ceil vs round

Same input, three directions.

Lodash
[
  _.floor(4.6),
  _.ceil(4.6),
  _.round(4.6)
];
// → [4, 5, 5]
Try It Yourself

How It Works

  1. floor. Always down → 4.
  2. ceil. Always up → 5.
  3. round. Nearest → 5 (4.6 is closer to 5).
  4. Family. All three share Lodash’s precision helper.

Browser & Runtime Support

_.floor is a Lodash 4.x Math helper (since 3.10.0). It builds on native Math.floor plus Lodash number coercion.

✓ Stable · Lodash 3.10.0+

_.floor()

Available in [email protected] full builds and the lodash/floor modular import. Works in evergreen browsers and Node / Bun / Deno when Lodash is installed.

100% With Lodash 4.x
Google Chrome Supported · Desktop & Mobile
Full support
Mozilla Firefox Supported · Desktop & Mobile
Full support
Apple Safari Supported · macOS & iOS
Full support
Microsoft Edge Supported · Chromium
Full support
Internet Explorer No native support · Use a polyfill
Polyfill
Opera Supported · Modern versions
Full support
Samsung Internet Supported · Android
Full support
Bun Supported · JavaScript runtime
Supported
Deno Supported · JavaScript runtime
Supported
Node.js Supported · Server runtime
Supported
Android WebView Supported · Modern WebView
Full support
_.floor Lodash 4.x+

Bottom line: Safe for production once Lodash is on the page or in your bundle. Prefer import floor from "lodash/floor" for smaller builds.

Frequently Asked Questions

_.floor(number, [precision=0]) rounds number down (toward −Infinity) to the given precision. With precision 0 it matches Math.floor for finite numbers.
Positive precision keeps that many decimal places (rounded down). Negative precision rounds down to tens (−1), hundreds (−2), and so on — e.g. _.floor(4060, -2) → 4000.
floor always rounds toward −Infinity. ceil rounds toward +Infinity. round goes to the nearest value.
Yes. _.floor(-4.1) → -5 because -5 is less than -4.1 (toward −Infinity).
Yes. The value is passed through toNumber, so _.floor('4.9') → 4. Non-numeric strings become NaN.
Use import floor from "lodash/floor" or require("lodash/floor") for tree-shaking. Full build: import _ from "lodash" then _.floor.

Next: _.max()

Get the largest value in an array of numbers.

_.max() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

10 people found this page helpful