---
title: "Format - Liquid Tag Reference"
source: https://support.storeconnect.com/articles/format-tag-reference
type: article
format: markdown
site: StoreConnect Support — product and developer documentation for StoreConnect
site_index: https://storeconnect.com/llms.txt
docs_index: https://support.storeconnect.com/llms.txt
note: Append .md to any page or article URL on this site to get its Markdown form.
---
# Format - Liquid Tag Reference

The `format` tag declares the output format of the content it wraps, which sets how each `{{ }}` value inside it is escaped or encoded. Outside any `format` block, values are HTML-escaped.

A [feed](set-up-a-feed) already encodes values for the format it serves, so a feed template does not need this tag for that format. Use it to override one region, such as a script body, or a fragment you have already built yourself.

## Syntax


```liquid

{% format '<format>' %}
  ...
{% endformat %}

{% format '<format>', encode: false %}
  ...
{% endformat %}
```


| Property | Value |
|----------|-------|
| **Tag Name** | `format` |
| **Type** | Block tag |
| **Source** | Hydrofoil (core) |

The format can be a quoted string or a variable, such as the `format` variable a feed template receives.

## Formats

| Format | How `{{ }}` values are output |
|--------|-------------------------------|
| `html`, `xml` | HTML-escaped. This is also what happens with no `format` block. |
| `js` | JavaScript-escaped, so a value cannot break out of a script string |
| `json`, `jsonl` | JSON-encoded: strings quoted and escaped, numbers and booleans bare, `nil` as `null`, a list as a JSON array |
| `csv` | Escaped as a CSV cell: quoted only when the value contains a comma, double quote, or line break. `nil` is an empty cell. |
| `txt`, `md` | Raw, with no escaping |

Use the short format names in this table, not MIME types. An unrecognized format is HTML-escaped.

With `encode: false`, values inside the block are output raw, whatever the format.

A nested `format` block uses the format it declares. The outer format resumes after the inner block closes and does not re-encode the inner output.

## Examples

Escape values for a script inside an HTML page:


```liquid

<script>
  {% format 'js' %}
    var productName = "{{ product.name }}";
  {% endformat %}
</script>
```


Emit a fragment you have already built as JSON, without encoding it again:


```liquid

{%- new Map extra -%}
{%- assign extra = extra | set_key: "source", "storeconnect" -%}
{%- assign extra_json = extra | json -%}
{% format 'txt', encode: false %}{{ extra_json }}{% endformat %}
```


## Security

The `format` tag works in every template, not only feeds. A raw block (`txt`, `md`, or `encode: false`) turns off HTML-escaping for every value inside it. Never wrap customer-entered data in a raw block on an HTML page, because that removes the protection against cross-site scripting.

---

## Follow StoreConnect

- [Email Newsletter](https://storeconnect.com/c/lp-newsletter)
- [LinkedIn Newsletter](https://www.linkedin.com/build-relation/newsletter-follow?entityUrn=7444956928444862464)
- [YouTube](https://www.youtube.com/channel/UCngKdP2x8l1wcbAKW3tvU8g)
- [LinkedIn](https://www.linkedin.com/company/storeconnect)
- [X / Twitter](https://x.com/storeconnecthq)

## Popular Links

- [Partners](https://storeconnect.com/partners)
- [Become a Partner](https://storeconnect.com/become-a-partner)
- [News](https://storeconnect.com/articles/news)
- [Events](https://storeconnect.com/articles/events)
- [Feature Comparison](https://storeconnect.com/how-we-compare)
- [Download a free trial](https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FMkeKUAT)
- [Book a Demo](https://storeconnect.com/contact)

## Documentation

- [Help documentation](https://support.storeconnect.com/help-documentation)
- [AI agents](https://support.storeconnect.com/ai)
- [Videos & tutorials](https://support.storeconnect.com/videos-tutorials)
- [Developer reference](https://support.storeconnect.com/developer-reference)
- [Release notes](https://support.storeconnect.com/release-notes)
- [Troubleshooting](https://support.storeconnect.com/troubleshooting)
- [Trust Center](https://trust.getstoreconnect.com/)
- [Status Page](https://status.storeconnect.com/)

## Contact

- info@getstoreconnect.com
- US +1 415 745 3230
- AUS +61 2 8365 2308

100 S Ashley Dr, Suite 600-2461
Tampa FL 33602-600 USA

Level 22, Sydney Place
180 George Street
Sydney, NSW, 2000, AUS

## Machine-readable

- [Site index for agents](https://storeconnect.com/llms.txt): curated map of the StoreConnect site in llms.txt format
- [Documentation index for agents](https://support.storeconnect.com/llms.txt): full technical and product documentation map

Every page and article on this site has a Markdown rendering: append `.md` to its URL.

Continue in Markdown: [Help documentation](https://support.storeconnect.com/help-documentation.md) · [Developer reference](https://support.storeconnect.com/developer-reference.md) · [Videos & tutorials](https://support.storeconnect.com/videos-tutorials.md) · [Release notes](https://support.storeconnect.com/release-notes.md)

---

StoreConnect Support — https://support.storeconnect.com/articles/format-tag-reference