---
title: "Difference between CHAR vs VARCHAR"  
description: "Difference between CHAR vs VARCHAR"  
author: "Anubhav Sharma"  
published: 2026-05-01  
updated: 2026-05-01  
canonical: https://www.mindstick.com/interview/34500/difference-between-char-vs-varchar  
category: "database"  
tags: ["database", "sql server"]  
reading_time: 2 minutes  

---

# Difference between CHAR vs VARCHAR

### CHAR

- **Fixed-length** data type
- Always uses the **full defined size** (pads with spaces)
- Faster for **consistent-length data**

## Example:

```plaintext
CHAR(10)
```

Stores exactly 10 characters

`'ABC'` → stored as `'ABC '`

### VARCHAR

- **Variable-length** data type
- Uses **only required storage**
- More efficient for **varying-length data**

## Example:

```plaintext
VARCHAR(10)
```

Stores up to 10 characters

`'ABC'` → stored as `'ABC'`

## Key Differences

| Feature | CHAR | VARCHAR |
| --- | --- | --- |
| Length | Fixed | Variable |
| Storage | Always full size | Actual data size |
| Performance | Slightly faster | Slightly slower |
| Space Usage | Wastes space | Efficient |
| Use Case | Fixed data (e.g., PIN) | Dynamic text (e.g., Name) |

## When to Use

Use **CHAR**:

- Fixed-length values (e.g., country codes, flags)

Use **VARCHAR**:

- Names, emails, addresses (varying length)

## Final Thought

- **CHAR = Fixed & predictable**
- **VARCHAR = Flexible & space-efficient**

## Answers

### Answer by Anubhav Sharma

### CHAR

- **Fixed-length** data type
- Always uses the **full defined size** (pads with spaces)
- Faster for **consistent-length data**

## Example:

```plaintext
CHAR(10)
```

Stores exactly 10 characters

`'ABC'` → stored as `'ABC '`

### VARCHAR

- **Variable-length** data type
- Uses **only required storage**
- More efficient for **varying-length data**

## Example:

```plaintext
VARCHAR(10)
```

Stores up to 10 characters

`'ABC'` → stored as `'ABC'`

## Key Differences

| Feature | CHAR | VARCHAR |
| --- | --- | --- |
| Length | Fixed | Variable |
| Storage | Always full size | Actual data size |
| Performance | Slightly faster | Slightly slower |
| Space Usage | Wastes space | Efficient |
| Use Case | Fixed data (e.g., PIN) | Dynamic text (e.g., Name) |

## When to Use

Use **CHAR**:

- Fixed-length values (e.g., country codes, flags)

Use **VARCHAR**:

- Names, emails, addresses (varying length)

## Final Thought

- **CHAR = Fixed & predictable**
- **VARCHAR = Flexible & space-efficient**


---

Original Source: https://www.mindstick.com/interview/34500/difference-between-char-vs-varchar

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
