What is an integer overflow?

When an integer is created, the computer allocates 32-bits to store its value. However, there might be data that is larger than 32- bits; for example, a sextillion (a billion trillion) is 70 digits in binary. When an integer value is larger than 32- bits, an integer overflow occurs. In case the integer value does not fit in the 32-bit block, a double data type can be used instead of int.

svg viewer

Another reason that integer overflow could occur is if a 32-bit integer was added to another 32-bit integer, and the result went up to 33-bits.

New on Educative
Learn to Code
Learn any Language as a beginner
Develop a human edge in an AI powered world and learn to code with AI from our beginner friendly catalog
🏆 Leaderboard
Daily Coding Challenge
Solve a new coding challenge every day and climb the leaderboard

Free Resources

Copyright ©2025 Educative, Inc. All rights reserved