---

slug: /blob-type
---

# BLOB type

The `BLOB` type is a binary large object type that can store a variable amount of data.

The `BLOB` type includes four types: `TINYBLOB`, `BLOB`, `MEDIUMBLOB`, and `LONGBLOB`. They differ in the maximum length of values they can store.

`BLOB` values are treated as binary strings (byte strings) with a binary character set and collation. Comparisons and sorting are based on the numeric values of the bytes in the column values.

When strict SQL mode is not enabled, if a value assigned to a `BLOB` column exceeds the maximum length of the column, the excess part is truncated and an alert is generated. When strict SQL mode is enabled, if the truncated part contains non-space characters, an error (not an alert) occurs, and the value is not inserted.

## TINYBLOB

`TINYBLOB` is a `BLOB` type with a maximum length of 255 bytes.

The syntax for `TINYBLOB` is as follows:

```sql
TINYBLOB
```

## BLOB

The maximum length of a `BLOB` column is 65,535 bytes.

You can optionally specify a length `M` for the `BLOB` type. The syntax is as follows:

```sql
BLOB[(M)]
```

## MEDIUMBLOB

`MEDIUMBLOB` is a `BLOB` type with a maximum length of 16,777,215 bytes.

The syntax for `MEDIUMBLOB` is as follows:

```sql
MEDIUMBLOB
```

## LONGBLOB

`LONGBLOB` is a `BLOB` type with a maximum length of 536870910 bytes. The maximum effective length of a `LONGBLOB` column depends on the maximum packet size configured in the client/server protocol and the available memory.

The syntax for `LONGBLOB` is as follows:

```sql
LONGBLOB
```