# What is the difference between int(8) and int(5) in mysql? [duplicate]

I found out, that if you have a field defined as INT(8) without ZEROFILL it will behave exactly as INT(5)

in both cases the maximum value is

``````−2,147,483,648 to 2,147,483,647, from −(2^31) to 2^31 − 1
``````

or do i miss something?

I found this Question: https://dba.stackexchange.com/a/370/12923

The (5) represents the display width of the field. From the manual, it states:

The display width does not constrain the range of values that can be stored in the column. Nor does it prevent values wider than the column display width from being displayed correctly. For example, a column specified as SMALLINT(3) has the usual SMALLINT range of -32768 to 32767, and values outside the range permitted by three digits are displayed in full using more than three digits.

The display width, from what I can tell, can be used to left-pad numbers that are less than the defined width. So 00322, instead of 322. TBH, I've never used it.

But it doesn't affect the storage size of the column. An int will take up more space than a smallint.

so there seems to be no difference then.

• so I assume, I am right here: there is no difference. Only if I would use ZEROFILL, there would show a different behaviour in smaller numbers Commented Feb 9, 2013 at 11:58

Essentially what you listed is the max value for `INT` and not `BIGINT`.
• `INT(8)` is the equivalent of typing `INT` with a display width of 8 digits
• `INT(4)` is the equivalent of typing just `INT` with 4 display lengths.
The range of `BIGINT` is -9223372036854775808 to 9223372036854775807 or 0 to 18446744073709551615.