Back to Tools

YAML Key Sorter

Processed Locally

Sort YAML object keys alphabetically in ascending or descending order, with recursive or top-level only options.

Options

Frequently Asked Questions

Recursive sorting sorts keys at all levels of nested objects. When enabled, it sorts keys in the top level and also within all nested objects. When disabled, only top-level keys are sorted.
No, array elements maintain their original order. Only object keys are sorted. If array elements are objects, their keys can be sorted (when recursive sorting is enabled), but the array order itself is preserved.
Descending order sorts keys from Z to A (reverse alphabetical). This is useful when you want keys in reverse alphabetical order. The default is ascending (A to Z).
Yes, the sorter attempts to preserve YAML comment placement and basic formatting. However, some formatting details may change when keys are reordered. The output is always valid, well-formatted YAML.