# Choose a file format

> Pick between whole-file syncing and key-by-key syncing for each settings file, with the built-in WHOLE_FILE, PROPERTIES and KEY_VALUE formats compared.

URL: https://xichil.dev/docs/settings-saver/v1/guides/choosing-a-format/ · Updated: 2026-11-16 · Applies to: Fabric, Quilt, Legacy Fabric, Forge, NeoForge, MC 1.7.10 - 26.3

The format you give a file decides whether Settings Saver treats it as one blob or as separate settings.
This guide helps you pick one for each file.

## Prerequisites

- [Register files and directories](https://xichil.dev/docs/settings-saver/v1/guides/files-and-directories/index.md)

## Whole file or key by key

A [SettingsFileFormat](https://xichil.dev/javadoc/settings-saver/v1/dev/xichil/settingssaver/api/v1/SettingsFileFormat.html) reads a file into a
flat `key -> value` map. With a real format, Settings Saver compares the file key by key. Without one,
the whole file is a single value.

| | Whole file (`WHOLE_FILE`, the default) | Key by key (any other format) |
| --- | --- | --- |
| Works for | any UTF-8 text file | files the format can parse |
| Comments and layout | kept exactly | up to the format (`PROPERTIES` drops comments) |
| What a save writes to the profile | the whole file | only the settings the player changed |
| Two instances change different settings | the newest save wins, the other change is lost | both changes are kept |
| Players can exclude single settings | no, only the whole file | yes |
| Loading a profile | replaces the instance's file | merges the profile's values over the instance's file |
| Fixes between versions | see the file as one value under the key `content` | see every key |

Use key by key whenever a format fits. Use whole file for files with free-form content, or when keeping
the file's comments matters more than merging.

## The built-in formats

All three are constants of
[SettingsFileFormats](https://xichil.dev/javadoc/settings-saver/v1/dev/xichil/settingssaver/api/v1/SettingsFileFormats.html). Each is a stateless
singleton that any number of files and mods can share.

### `WHOLE_FILE`

The whole file as one value under the key `content` (`SettingsFileFormats.WHOLE_FILE_KEY`), written back
character for character. It is what `.file(path)` and `.directory(path)` use.

```java
.file("config/mymod.json")                                    // the same as:
.file("config/mymod.json", SettingsFileFormats.WHOLE_FILE)
```

A player who excludes the key `content` for your mod turns saving of such a file off.

### `PROPERTIES`

Simple `key=value` lines:

```properties title="config/mymod.properties"
# My Mod settings
renderDistance = 12
showHud=true
```

```java
.file("config/mymod.properties", SettingsFileFormats.PROPERTIES)
```

Reading:

- Blank lines and lines whose first non-blank character is `#` or `!` are skipped.
- Every other line is split at its first `=`. Key and value are trimmed of surrounding whitespace.
- Lines without `=`, or starting with it, are skipped. If a key appears twice, the last line wins.
- It is **not** the full `java.util.Properties` syntax: escapes such as `\t` or `\=`, `:` as a separator
  and continuation lines ending in `\` are taken literally.

Writing: one `key=value` line per setting, in order.

> **Warning:** `PROPERTIES` does not write comments or blank lines back. After Settings Saver loads a profile into the
> file, they are gone. If your file's comments matter, use `WHOLE_FILE`, or have your mod write the comments
> again when it saves the file.

### `KEY_VALUE`

Minecraft's `key:value` lines, as in `options.txt`:

```text title="config/mymod.txt"
renderDistance:12
serverAddress:play.example.com:25565
```

```java
.file("config/mymod.txt", SettingsFileFormats.KEY_VALUE)
```

Reading:

- Each line is split at its first `:`. Everything after it is the value, more colons included, so
  `serverAddress` above has the value `play.example.com:25565`.
- Nothing is trimmed: `key: value` has the value ` value`, with the leading space.
- Lines without a colon, or starting with one, are skipped. If a key appears twice, the last line wins.

Writing: one `key:value` line per setting, in order.

## Which one for my file

| Your file | Use |
| --- | --- |
| `key=value` lines | `PROPERTIES` |
| `key:value` lines | `KEY_VALUE` |
| `[section]` headers with `key = value` lines | [your own format](https://xichil.dev/docs/settings-saver/v1/guides/custom-format/index.md) ([complete example](https://xichil.dev/docs/settings-saver/v1/examples/sectioned-format/index.md)) |
| TOML, JSON, YAML | [your own format](https://xichil.dev/docs/settings-saver/v1/guides/custom-format/index.md) that flattens nested keys, or `WHOLE_FILE` |
| free text, scripts, lists | `WHOLE_FILE` |
| a file whose comments must survive | `WHOLE_FILE` |

## Next steps

- [Write your own file format](https://xichil.dev/docs/settings-saver/v1/guides/custom-format/index.md)
- [How syncing works](https://xichil.dev/docs/settings-saver/v1/concepts/how-syncing-works/index.md): what "only the settings the player changed" means.
