---
schema_version: "1"
id: ff791bc7d15fd9418ce6907ab20893e31929dadfd858d18b6ce20c0d20394f29
title: DECODE
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/data-cloud/data-cloud-query-guide/references/data-cloud-sql-reference/scalar-func/string-func/decode.md
canonical_url: https://developer.salesforce.com/docs/data/data-cloud-query-guide/references/dc-sql-reference/decode.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: a2032012af2eef78541b64ae674799bfb04a46cec35c1d2eae631162c441fcbc
products:
  - Data 360 Query Guide
  - Data 360 Developer Documentation
---
# `DECODE`

**Applies to:** ✅ Data 360 SQL ✅ Tableau Hyper API

Decodes binary data from a textual representation.

## Syntax

```sql
decode(<string>, <format>)
```

## Arguments

### Required

- `<string>`: The encoded string to decode.
- `<format>`: The encoding format of the string (`base64`, `hex`, or `escape`).

## Returns

Returns bytea (binary data) decoded from the textual representation.

## Examples

### Decode Base64

Decode a base64-encoded string.

```sql
SELECT decode('MTIzXDAwMFwwMDE=', 'base64') AS result;
```

Returns `123\000\001`.

## Related Documentation

- [String Types](https://developer.salesforce.com/docs/data/data-cloud-query-guide/datatype/string.md)
