Skip to main content

What is the difference between CHAR and VARCHAR?

Entry MySQL
Quick Answer CHAR(n): fixed-length string - always stores exactly n bytes, padded with spaces. Fast for fixed-length data (country codes, status flags). VARCHAR(n): variable-length string - stores actual length + 1-2 length bytes. More space-efficient for varying lengths. CHAR is slightly faster to read; VARCHAR saves space. Use CHAR for truly fixed-length values, VARCHAR for everything else.

Answer

CHAR is fixed-length storage while VARCHAR is variable-length. VARCHAR saves space and is preferred for dynamic text.
S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice