Skip to content
D DocNectar

Free Floor Division Calculator

Calculate floor division (a div b) with the remainder shown, correctly handling negative operands.

100% Free No Signup Works on all devices

Built and fact-checked by the DocNectar team — see our editorial standards

Thanks for rating!

Key Features

Instant Calculation

Get accurate results in real time with our optimized algorithm.

Mobile Friendly

Fully responsive design. Works on all devices & screen sizes.

Privacy Focused

Your data stays on your device. We don't store any inputs.

100% Free

No hidden costs. This tool is completely free forever.

Floor division rounds the result of a division down to the nearest integer (toward negative infinity), which differs from simple truncating division whenever negative numbers are involved. This tool calculates the correct floor-division quotient and remainder for any integers.

How it works

Floor division computes ⌊a/b⌋ — the quotient rounded toward negative infinity, not toward zero. The remainder is then a minus the quotient times b, which for floor division always has the same sign as the divisor.

  1. Enter dividend (a).
  2. Enter divisor (b).
  3. Click Calculate to see your results.

Examples

A negative dividend

−7 divided by 2: truncating division gives −3 (rounding toward zero), but floor division gives −4, since −4 is the largest integer that is ≤ −3.5. The remainder is −7 − (−4×2) = 1.

Who should use it

  • Computer science and programming exercises involving modular arithmetic.
  • Verifying floor-division behavior across different programming languages.

Industry applications

  • Computer science and software engineering
  • Mathematics education (number theory)

Advantages

  • Correctly implements true floor division for all sign combinations.
  • Shows both the quotient and matching remainder.

Limitations

  • Only supports integer inputs — not general real-number floor division.

Common mistakes to avoid

  • Assuming a programming language's built-in integer division always performs floor division — many languages (including PHP's intdiv) truncate toward zero instead.

Best practices

  • When working with negative numbers in division-heavy code, explicitly verify whether floor division or truncating division is required, since they diverge for mixed-sign operands.

Tips

  • If your remainder is negative but your divisor is positive, you're likely using truncating division somewhere instead of true floor division.

Frequently asked questions

Many programming languages truncate toward zero by default for integer division, which gives a different (and often unexpected) result from true floor division whenever the dividend and divisor have different signs.
With true floor division, the remainder always has the same sign as the divisor (or is zero) — so if the divisor is positive, the remainder from floor division is never negative.

Get new calculators and guides in your inbox

No spam — just new tools like Floor Division Calculator and practical guides.

Favorites