What is the name of the exception raised when dividing by zero in Python?

The story behind the answer

Python raises `ZeroDivisionError` when a division or modulo operation uses zero as its divisor.

For example, `10 / 0`, `10 // 0`, `10 % 0`, and `divmod(10, 0)` raise this built-in exception. The interpreter stops the operation and reports the exception unless the program catches it with a `try`/`except` block. Its message commonly identifies the problem as “division by zero.”

`ZeroDivisionError` belongs to Python’s arithmetic-exception family: it is a subclass of `ArithmeticError`, which in turn derives from `Exception`. `ArithmeticError` is therefore a broader category, not the most specific canonical answer for a zero divisor. `ValueError` is also too general and is normally used when an argument has the right type but an inappropriate value.

Python does not use a built-in exception named `DivisionByZero`; that name may appear in other languages or in application-specific code. The same Python exception applies whether the operands are integers, floating-point numbers, or complex numbers when the denominator is zero.

Source: Wikipedia · fact-checked Aug. 2026

Add question to a list

Choose a list to keep this question in: