> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Overview of supported data formats for input and output in ClickHouse

# Formats for input and output data

export const CloudNotSupportedBadge = () => {
  return <div className="cloudNotSupportedBadge">
            <div className="cloudNotSupportedIcon">
            <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
                <path strokeWidth="1.5" d="M6.33366 12.6666L12.3739 12.6667C13.6593 12.6667 14.7073 11.6187 14.7073 10.3334C14.7073 9.04804 13.6593 8.00003 12.3739 8.00003C12.3739 8.00003 12.3337 7.66659 12.0003 7.33325M10.667 5.33322C8.00033 2.33325 4.45395 4.78537 4.14195 6.68203C2.55728 6.7627 1.29395 8.06203 1.29395 9.6667C1.29395 11.3234 2.66699 12.6666 4.00033 12.6666" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
                <path strokeWidth="1.5" d="M2.66699 14L12.0003 4.66663" stroke="currentColor" strokeLinecap="round" strokeLinejoin="round" />
            </svg>

        </div>
            Not supported in ClickHouse Cloud
        </div>;
};

<h1 id="formats-for-input-and-output-data">
  Formats for input and output data
</h1>

ClickHouse supports most of the known text and binary data formats. This allows easy integration into almost any working
data pipeline to leverage the benefits of ClickHouse.

<h2 id="input-formats">
  Input formats
</h2>

Input formats are used for:

* Parsing data provided to `INSERT` statements
* Performing `SELECT` queries from file-backed tables such as `File`, `URL`, or `HDFS`
* Reading dictionaries

Choosing the right input format is crucial for efficient data ingestion in ClickHouse. With over 70 supported formats,
selecting the most performant option can significantly impact insert speed, CPU and memory usage, and overall system
efficiency. To help navigate these choices, we benchmarked ingestion performance across formats, revealing key takeaways:

* **The [Native](/reference/formats/Native) format is the most efficient input format**, offering the best compression, lowest
  resource usage, and minimal server-side processing overhead.
* **Compression is essential** - LZ4 reduces data size with minimal CPU cost, while ZSTD offers higher compression at the
  expense of additional CPU usage.
* **Pre-sorting has a moderate impact**, as ClickHouse already sorts efficiently.
* **Batching significantly improves efficiency** - larger batches reduce insert overhead and improve throughput.

For a deep dive into the results and best practices,
read the full [benchmark analysis](https://www.clickhouse.com/blog/clickhouse-input-format-matchup-which-is-fastest-most-efficient).
For the full test results, explore the [FastFormats](https://fastformats.clickhouse.com/) online dashboard.

<h2 id="output-formats">
  Output formats
</h2>

Formats supported for output are used for:

* Arranging the results of a `SELECT` query
* Performing `INSERT` operations into file-backed tables

<h2 id="formats-overview">
  Formats overview
</h2>

The supported formats are:

| Format                                                                                                           | Input | Output |
| ---------------------------------------------------------------------------------------------------------------- | ----- | ------ |
| [TabSeparated](/reference/formats/TabSeparated/TabSeparated)                                                     | ✔     | ✔      |
| [TabSeparatedRaw](/reference/formats/TabSeparated/TabSeparatedRaw)                                               | ✔     | ✔      |
| [TabSeparatedWithNames](/reference/formats/TabSeparated/TabSeparatedWithNames)                                   | ✔     | ✔      |
| [TabSeparatedWithNamesAndTypes](/reference/formats/TabSeparated/TabSeparatedWithNamesAndTypes)                   | ✔     | ✔      |
| [TabSeparatedRawWithNames](/reference/formats/TabSeparated/TabSeparatedRawWithNames)                             | ✔     | ✔      |
| [TabSeparatedRawWithNamesAndTypes](/reference/formats/TabSeparated/TabSeparatedRawWithNamesAndTypes)             | ✔     | ✔      |
| [Template](/reference/formats/Template/Template)                                                                 | ✔     | ✔      |
| [TemplateIgnoreSpaces](/reference/formats/Template/TemplateIgnoreSpaces)                                         | ✔     | ✗      |
| [CSV](/reference/formats/CSV/CSV)                                                                                | ✔     | ✔      |
| [CSVWithNames](/reference/formats/CSV/CSVWithNames)                                                              | ✔     | ✔      |
| [CSVWithNamesAndTypes](/reference/formats/CSV/CSVWithNamesAndTypes)                                              | ✔     | ✔      |
| [CustomSeparated](/reference/formats/CustomSeparated/CustomSeparated)                                            | ✔     | ✔      |
| [CustomSeparatedWithNames](/reference/formats/CustomSeparated/CustomSeparatedWithNames)                          | ✔     | ✔      |
| [CustomSeparatedWithNamesAndTypes](/reference/formats/CustomSeparated/CustomSeparatedWithNamesAndTypes)          | ✔     | ✔      |
| [SQLInsert](/reference/formats/SQLInsert)                                                                        | ✗     | ✔      |
| [Values](/reference/formats/Values)                                                                              | ✔     | ✔      |
| [Vertical](/reference/formats/Vertical)                                                                          | ✗     | ✔      |
| [JSON](/reference/formats/JSON/JSON)                                                                             | ✔     | ✔      |
| [JSONAsString](/reference/formats/JSON/JSONAsString)                                                             | ✔     | ✗      |
| [JSONAsObject](/reference/formats/JSON/JSONAsObject)                                                             | ✔     | ✗      |
| [JSONStrings](/reference/formats/JSON/JSONStrings)                                                               | ✗     | ✔      |
| [JSONColumns](/reference/formats/JSON/JSONColumns)                                                               | ✔     | ✔      |
| [JSONColumnsWithMetadata](/reference/formats/JSON/JSONColumnsWithMetadata)                                       | ✔     | ✔      |
| [JSONCompact](/reference/formats/JSON/JSONCompact)                                                               | ✔     | ✔      |
| [JSONCompactStrings](/reference/formats/JSON/JSONCompactStrings)                                                 | ✗     | ✔      |
| [JSONCompactColumns](/reference/formats/JSON/JSONCompactColumns)                                                 | ✔     | ✔      |
| [JSONEachRow](/reference/formats/JSON/JSONEachRow)                                                               | ✔     | ✔      |
| [PrettyJSONEachRow](/reference/formats/JSON/PrettyJSONEachRow)                                                   | ✗     | ✔      |
| [JSONEachRowWithProgress](/reference/formats/JSON/JSONEachRowWithProgress)                                       | ✗     | ✔      |
| [JSONStringsEachRow](/reference/formats/JSON/JSONStringsEachRow)                                                 | ✔     | ✔      |
| [JSONStringsEachRowWithProgress](/reference/formats/JSON/JSONStringsEachRowWithProgress)                         | ✗     | ✔      |
| [JSONCompactEachRow](/reference/formats/JSON/JSONCompactEachRow)                                                 | ✔     | ✔      |
| [JSONCompactEachRowWithNames](/reference/formats/JSON/JSONCompactEachRowWithNames)                               | ✔     | ✔      |
| [JSONCompactEachRowWithNamesAndTypes](/reference/formats/JSON/JSONCompactEachRowWithNamesAndTypes)               | ✔     | ✔      |
| [JSONCompactEachRowWithProgress](/reference/formats/JSON/JSONCompactEachRowWithProgress)                         | ✗     | ✔      |
| [JSONCompactStringsEachRow](/reference/formats/JSON/JSONCompactStringsEachRow)                                   | ✔     | ✔      |
| [JSONCompactStringsEachRowWithNames](/reference/formats/JSON/JSONCompactStringsEachRowWithNames)                 | ✔     | ✔      |
| [JSONCompactStringsEachRowWithNamesAndTypes](/reference/formats/JSON/JSONCompactStringsEachRowWithNamesAndTypes) | ✔     | ✔      |
| [JSONCompactStringsEachRowWithProgress](/reference/formats/JSON/JSONCompactStringsEachRowWithProgress)           | ✗     | ✔      |
| [JSONObjectEachRow](/reference/formats/JSON/JSONObjectEachRow)                                                   | ✔     | ✔      |
| [BSONEachRow](/reference/formats/BSONEachRow)                                                                    | ✔     | ✔      |
| [TSKV](/reference/formats/TabSeparated/TSKV)                                                                     | ✔     | ✔      |
| [Pretty](/reference/formats/Pretty/Pretty)                                                                       | ✗     | ✔      |
| [PrettyNoEscapes](/reference/formats/Pretty/PrettyNoEscapes)                                                     | ✗     | ✔      |
| [PrettyMonoBlock](/reference/formats/Pretty/PrettyMonoBlock)                                                     | ✗     | ✔      |
| [PrettyNoEscapesMonoBlock](/reference/formats/Pretty/PrettyNoEscapesMonoBlock)                                   | ✗     | ✔      |
| [PrettyCompact](/reference/formats/Pretty/PrettyCompact)                                                         | ✗     | ✔      |
| [PrettyCompactNoEscapes](/reference/formats/Pretty/PrettyCompactNoEscapes)                                       | ✗     | ✔      |
| [PrettyCompactMonoBlock](/reference/formats/Pretty/PrettyCompactMonoBlock)                                       | ✗     | ✔      |
| [PrettyCompactNoEscapesMonoBlock](/reference/formats/Pretty/PrettyCompactNoEscapesMonoBlock)                     | ✗     | ✔      |
| [PrettySpace](/reference/formats/Pretty/PrettySpace)                                                             | ✗     | ✔      |
| [PrettySpaceNoEscapes](/reference/formats/Pretty/PrettySpaceNoEscapes)                                           | ✗     | ✔      |
| [PrettySpaceMonoBlock](/reference/formats/Pretty/PrettySpaceMonoBlock)                                           | ✗     | ✔      |
| [PrettySpaceNoEscapesMonoBlock](/reference/formats/Pretty/PrettySpaceNoEscapesMonoBlock)                         | ✗     | ✔      |
| [Prometheus](/reference/formats/Prometheus)                                                                      | ✗     | ✔      |
| [Protobuf](/reference/formats/Protobuf/Protobuf)                                                                 | ✔     | ✔      |
| [ProtobufSingle](/reference/formats/Protobuf/ProtobufSingle)                                                     | ✔     | ✔      |
| [ProtobufList](/reference/formats/Protobuf/ProtobufList)                                                         | ✔     | ✔      |
| [Avro](/reference/formats/Avro/Avro)                                                                             | ✔     | ✔      |
| [AvroConfluent](/reference/formats/Avro/AvroConfluent)                                                           | ✔     | ✔      |
| [Parquet](/reference/formats/Parquet/Parquet)                                                                    | ✔     | ✔      |
| [ParquetMetadata](/reference/formats/Parquet/ParquetMetadata)                                                    | ✔     | ✗      |
| [Arrow](/reference/formats/Arrow/Arrow)                                                                          | ✔     | ✔      |
| [ArrowStream](/reference/formats/Arrow/ArrowStream)                                                              | ✔     | ✔      |
| [ORC](/reference/formats/ORC)                                                                                    | ✔     | ✔      |
| [One](/reference/formats/One)                                                                                    | ✔     | ✗      |
| [Npy](/reference/formats/Npy)                                                                                    | ✔     | ✔      |
| [RowBinary](/reference/formats/RowBinary/RowBinary)                                                              | ✔     | ✔      |
| [RowBinaryWithNames](/reference/formats/RowBinary/RowBinaryWithNames)                                            | ✔     | ✔      |
| [RowBinaryWithNamesAndTypes](/reference/formats/RowBinary/RowBinaryWithNamesAndTypes)                            | ✔     | ✔      |
| [RowBinaryWithDefaults](/reference/formats/RowBinary/RowBinaryWithDefaults)                                      | ✔     | ✗      |
| [RowBinaryWithNamesAndTypesAndDefaults](/reference/formats/RowBinary/RowBinaryWithNamesAndTypesAndDefaults)      | ✔     | ✗      |
| [Native](/reference/formats/Native)                                                                              | ✔     | ✔      |
| [Buffers](/reference/formats/Buffers)                                                                            | ✔     | ✔      |
| [Null](/reference/formats/Null)                                                                                  | ✗     | ✔      |
| [Hash](/reference/formats/Hash)                                                                                  | ✗     | ✔      |
| [XML](/reference/formats/XML)                                                                                    | ✗     | ✔      |
| [CapnProto](/reference/formats/CapnProto)                                                                        | ✔     | ✔      |
| [LineAsString](/reference/formats/LineAsString/LineAsString)                                                     | ✔     | ✔      |
| [LineAsStringWithNames](/reference/formats/LineAsString/LineAsStringWithNames)                                   | ✗     | ✔      |
| [LineAsStringWithNamesAndTypes](/reference/formats/LineAsString/LineAsStringWithNamesAndTypes)                   | ✗     | ✔      |
| [Regexp](/reference/formats/Regexp)                                                                              | ✔     | ✗      |
| [RawBLOB](/reference/formats/RawBLOB)                                                                            | ✔     | ✔      |
| [MsgPack](/reference/formats/MsgPack)                                                                            | ✔     | ✔      |
| [MySQLDump](/reference/formats/MySQLDump)                                                                        | ✔     | ✗      |
| [GeoJSON](/reference/formats/GeoJSON)                                                                            | ✔     | ✗      |
| [DWARF](/reference/formats/DWARF)                                                                                | ✔     | ✗      |
| [Markdown](/reference/formats/Markdown)                                                                          | ✗     | ✔      |
| [Form](/reference/formats/Form)                                                                                  | ✔     | ✗      |

You can control some format processing parameters with the ClickHouse settings. For more information read the [Settings](/reference/settings/formats) section.

<h2 id="formatschema">
  Format schema
</h2>

The file name containing the format schema is set by the setting `format_schema`.
It's required to set this setting when it is used one of the formats `Cap'n Proto` and `Protobuf`.
The format schema is a combination of a file name and the name of a message type in this file, delimited by a colon,
e.g. `schemafile.proto:MessageType`.
If the file has the standard extension for the format (for example, `.proto` for `Protobuf`),
it can be omitted and in this case, the format schema looks like `schemafile:MessageType`.

If you input or output data via the [client](/concepts/features/interfaces/client) in interactive mode, the file name specified in the format schema
can contain an absolute path or a path relative to the current directory on the client.
If you use the client in the [batch mode](/concepts/features/interfaces/client#batch-mode), the path to the schema must be relative due to security reasons.

If you input or output data via the [HTTP interface](/concepts/features/interfaces/http) the file name specified in the format schema
should be located in the directory specified in [format\_schema\_path](/reference/settings/server-settings/settings#format_schema_path)
in the server configuration.

<h2 id="skippingerrors">
  Skipping errors
</h2>

Some formats such as `CSV`, `TabSeparated`, `TSKV`, `JSONEachRow`, `Template`, `CustomSeparated` and `Protobuf` can skip broken row if parsing error occurred and continue parsing from the beginning of next row. See [input\_format\_allow\_errors\_num](/reference/settings/formats#input_format_allow_errors_num) and
[input\_format\_allow\_errors\_ratio](/reference/settings/formats#input_format_allow_errors_ratio) settings.
Limitations:

* In case of parsing error `JSONEachRow` skips all data until the new line (or EOF), so rows must be delimited by `\n` to count errors correctly.
* `Template` and `CustomSeparated` use delimiter after the last column and delimiter between rows to find the beginning of next row, so skipping errors works only if at least one of them is not empty.
