If your content is of fixed size, then you should use CHAR.
CHAR: It is used for the fixed length of character data. The maximum length of character data should be 254 characters.
VARCHAR: It’s used for the variable length of character data. But it’s valid for a maximum of 4046 characters.
Differences between CHAR and VARCHAR in MySQL are as follows based on a few parameters:
1. Storage Size | CHAR value’s storage size is equal to the maximum size of this column that you declare while you are creating the table. | Varchar value’s storage size is the actual length of the data entered, not the maximum size for this column. |
2. Memory Allocation | Char uses static memory allocation | Varchar uses dynamic memory allocation |
3. Data Type | ‘Char’ has the fixed-length data type which can be used to store character string value which is of fixed length. | Whereas, ‘Varchar’ is the variable-length data type that is used to store variable-length alphanumeric data. |
4. Length | Char variable’s length can be of any value from 0 to 255 | While the length of varchar variable ranges from 0 to 65,535 |
5. Data Entries | Char can be used when the data entries in a column are expected to be of the same size. | When the data entries in a column are expected to vary in size then Varchar can be used. |