## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> ZLIB_COMPRESS[ZLIB_COMPRESS]:::quoted
ZLIB_COMPRESS --> End((END))
```
## Purpose
The `ZLIB_COMPRESS` SQL function compresses a `blob` using the Zlib-algorithm.
See also [[ZLIB_DECOMPRESS]] and [[GZIP]].
Parameters:
- input (`blob`): The `blob` to compress.
Returns: a Zlib-compressed version of the input.
## Examples
The following example compresses and decompresses the nine ASCII characters `ACME` and retrieves the original text:
```sql
select blob_to_text(zlib_decompress(zlib_compress(ascii_to_blob('ACME'))))
-------------------
ACME
```
The following example compresses a text and retrieves the compressed `blob` encoded as base64:
```sql
select base64_encode(zlib_compress('VGhpcyBpcyBhIHZlcnkgbG9uZyB0ZXh0IHRvIHRlc3QgdGhlIFpMaWIgY29tcHJlc3Npb24gbWV0aG9k'))
-------------------
eJwLycgsVgCiRIWy1KJKhZz8vHSFktSKEoWSfCBdDKQzUhWifDKTFJLzcwuKUouLM/PzFHJTSzLyUwCN0xX5
```