---
schema_version: 1
route: /t/yq.md
tool: "yq"
---

# sincecutoff.com /t/yq — yq

- name: yq
- kind: cli
- children: none
- homepage: <https://github.com/mikefarah/yq>

Changes to the tools coding agents drive, since a model's training cutoff, each linked to its first-party source. Check installed versions and limitations before acting; a cutoff date does not establish what a model knows.
Original editorial content: [Apache 2.0](https://sincecutoff.com/v1/data-license.txt), by [0xPatrick](https://0xpatrick.dev). Preserve applicable license and [NOTICE](https://sincecutoff.com/notice.txt) attribution when redistributing. Third-party source text and examples retain their own rights. [License scope and attribution](https://sincecutoff.com/v1/license.json).
To stay current, read the changes feed: [`/v1/changes.md?tool=yq`](https://sincecutoff.com/v1/changes.md?tool=yq) (or `.json`), adding `since=YYYY-MM-DD` for your training cutoff. Entries for registered children are included; the registry itself is `/v1/tools.json`. How to page and save your place: [llms.txt](https://sincecutoff.com/llms.txt).

### yq adds base64url operators (2026-09-29)
- slug: yq-adds-base64url-operators-489c178627f8
- score: 0.95

How to use it:

When a value needs URL-safe Base64 transformation, use `@base64url` to encode it or `@base64urld` to decode it. The release identifies these operators as RFC 4648 §5; the docs do not show examples for these specific operators.

Examples:

```
yq '.<field> | @base64url' <input.yml>
```

```
yq '.<field> | @base64urld' <input.yml>
```

- why_it_matters: Encode or decode base64url values while transforming data.
- sources: <https://github.com/mikefarah/yq/releases/tag/v4.54.1>, <https://mikefarah.gitbook.io/yq/operators/encode-decode>
- gotchas: "Version: v4.54.1"; "@base64url (required): Encode the piped-in value as a string; the release adds this operator for RFC 4648 §5."; "@base64urld (required): Decode the piped-in value; the release adds this operator for RFC 4648 §5."; "<field> (required): Expression selecting the value to transform; the docs demonstrate piping a selected field to an encode operator."; "<input.yml> (required): Input file argument, following the documented operator example."; "Prerequisite: Encoding and decoding assume UTF-8 string content, not binary content."; "The operators are identified as following RFC 4648 §5."

### yq adds jq-style conditional operator (2026-09-29)
- slug: yq-adds-jq-style-conditional-operator-b85a2f179130
- score: 0.97

How to use it:

When transforming YAML or another supported input with yq v4.54.1, use the jq-style `if … then … elif … else … end` expression to choose a result by condition.

Examples:

```
yq 'if <condition> then <result> elif <condition> then <result> else <result> end' <input-file>
```

- why_it_matters: Evaluate a jq-style conditional expression while transforming YAML or other supported data.
- before: The official tips page says to combine `with` and `select` to approximate if/elif/else logic; it notes that the approach has no `else` concept and may require extra logic.
- sources: <https://github.com/mikefarah/yq/releases/tag/v4.54.1>, <https://github.com/mikefarah/yq/blob/v4.54.1/README.md>, <https://mikefarah.gitbook.io/yq/usage/tips-and-tricks>
- gotchas: "Version: v4.54.1"; "if <condition> (required): Begins the conditional and supplies the first condition. The v4.54.1 release note documents the operator; detailed condition semantics were not found."; "then <result> (required): Supplies the result for the preceding condition. Detailed result semantics were not found."; "elif <condition> then <result>: Adds a further condition and its result; the release note names `elif` as part of the operator. Detailed behavior was not found."; "else <result> (required): Supplies the alternative result; the release note names `else` as part of the operator. Detailed behavior was not found."; "end (required): Closes the conditional expression."; "<input-file> (required): Input file to process; yq also supports reading input from standard input."; "Prerequisite: Use yq v4.54.1 or later for the conditional operator; the release note announces it in v4.54.1."; "Prerequisite: Install or otherwise have the yq command available; the README describes it as a standalone command-line processor."; "Docs conflict: The tips page says yq had not yet added if expressions, but it predates v4.54.1 and conflicts with the v4.54.1 release note. Use the release note for the new operator's availability."

### yq compact sequence indentation flag (2026-01-31)
- slug: yq-compact-sequence-indentation-flag-c93ceff36c6d
- score: 0.90

How to use it:

When formatting YAML output, add `--yaml-compact-seq-indent` (or `-c`) to `yq` so `- ` is counted as part of the indentation.

Examples:

```
yq --yaml-compact-seq-indent '<expression>' <file.yaml>
```

- why_it_matters: Format YAML output with compact sequence indentation when preparing repository data.
- sources: <https://github.com/mikefarah/yq/releases/tag/v4.52.1>, <https://github.com/mikefarah/yq/blob/v4.52.1/cmd/root.go>
- gotchas: "Version: v4.52.1"; "--yaml-compact-seq-indent / -c: Boolean flag; enables compact sequence indentation, where `- ` is considered part of the indentation."

### yq parent negative indices and root command (2026-01-31)
- slug: yq-parent-negative-indices-and-root-command-f78972ae9deb
- score: 0.92

How to use it:

When a query needs an ancestor, use `parent` with a negative index; use `root` to reference the top-level document. The official docs found do not show runnable syntax for negative `parent` indices or the `root` command.

Examples:

```
yq '.a.b.c | parent(2)' <file>
```

- why_it_matters: Reference the top-level document or a parent element while querying structured repository data.
- sources: <https://github.com/mikefarah/yq/releases/tag/v4.52.1>, <https://mikefarah.gitbook.io/yq/operators/parent>
- gotchas: "Version: v4.52.1"; "parent(n): Returns the parent node; `n` is the number of levels to go up and defaults to 1. Negative values are not documented on this page."
