## Syntax
```mermaid
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> GZIP[GZIP]:::quoted
GZIP --> End((END))
```
## Purpose
The `GZIP` SQL function compresses a BLOB using the GZIP-algorithm.
See also [[UNGZIP]].
Parameters:
- Input (`blob`): The BLOB to compress. BASE64 decoding is applied automatically when a `varchar2` text is provided.
Returns: a GZIP-compressed version of the input as `blob`.
## Examples
The following example retrieves compressed and decompressed representation of the nine ASCII characters `invantive`:
```sql
select base64_encode(ungzip(gzip('aW52YW50aXZl')))
-------------------
aW52YW50aXZl
```
The following example retrieves the length of a GZIP-compressed variant of the single byte ASCII character `x`:
```sql
select length(gzip('eA=='))
-------------------
21
```
The following example retrieves the length of a GZIP-compressed variant of the 1200 characters representing 100 times the BASE64 encoding of the nine ASCII characters `invantive`:
```sql
select length(gzip(rpad('aW52YW50aXZl', 1200, 'aW52YW50aXZl')))
-------------------
37
```