You are designing a database table for a web application that requires to store IP address of users who visits the site. The IP address is required to be stored a character data in the table. To define size of the character column you need to know maximum length of IP address. So, what is the maximum length of an IP address?
The IPv4 version of IP address is in the following format
To store IPv4 address we require 15 characters.
The IPv6 version of IP address is grouped into sets of 4 hex digits separated by colons, like the below
To store IPv6 address you require a 39 characters long column.
As IPv4 and IPv6 are the commonly use protocols, you better define a column with 39 characters length so that both the format address are saved in to the table without any issues.