What does INT(11) mean in MySQL?

Here's a hint: it has nothing to do with length

Joel Clermont
Joel Clermont
2023-10-10

When looking at column definitions in MySQL, you'll see VARCHAR(255) and you know it means that the column can store up to 255 characters, and no more.

There is a similar-seeming property for numeric types, like INT(11). The database tools I frequently use even show this number in the same way as the VARCHAR length.

I was working in a legacy database recently and saw some very bizarre numbers like INT(4) or INT(200) and it got me curious as to what it actually means, since it doesn't impact the acceptable range of numbers you can store.

The MySQL docs explain that this attribute is for setting display width. It's purely for display purposes in database tools that support it. And it's going away. In MySQL 8.0.17, this attribute was deprecated.

Here to help,

Joel

P.S. Wish you could ship new features more quickly? We can help.

Toss a coin in the jar if you found this helpful.
Want a tip like this in your inbox every weekday? Sign up below 👇🏼

Level up your Laravel skills!

Each 2-minute email has real-world advice you can use.