---
title: "math.floor"
space: "Student Handbook"
url: "https://portal.cs17.org/student-handbook/python-manual/math/floor"
updated: "2026-10-05"
---

Rounds a number down.

## Synopsis

```python
import math
math.floor(number)
```

## Description

`floor` always goes down, towards minus infinity. For negative numbers that differs from `int`, which goes towards zero.

## Parameters

| Name | Meaning |
| --- | --- |
| `number` | An int or a float. |

## Return value

An `int`.

## Example

```python
import math

print(math.floor(3.7))
print(math.floor(-3.7))
print(int(-3.7))
```

It prints:

```text
3
-4
-3
```

## Common mistake

```python
import math

print(math.floor("3.7"))
```

Python stops with:

```text
TypeError: must be real number, not str
```

`floor` needs a number. Convert first: `math.floor(float("3.7"))`.

## See also

[math.ceil](/student-handbook/python-manual/math/ceil), [int](/student-handbook/python-manual/built-in-functions/int), [round](/student-handbook/python-manual/built-in-functions/round)

[math.floor in the Python documentation](https://docs.python.org/3/library/math.html#math.floor)
