# Zero Pad IDs

Paste a CSV, TSV or list of IDs and pad (or strip) leading zeros to a fixed width, so ZIP codes, SKUs and account numbers sort and join again. Runs locally.

## Run it

- **CLI:** `gizza tool zero-pad-ids "id,name
42,ada
7,linus
12345,grace"`
- **Web:** https://gizza.ai/tools/zero-pad-ids/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/zero-pad-ids/tool.json

## Inputs

- `input` — CSV / TSV table, or one ID per line _(field)_
- `delimiter` — Delimiter (or 'auto' to detect) _(field)_
- `columns` — Only these columns (names or 1-based positions; blank = all) _(field)_
- `width` — Target width (0 = auto-fit each column to its widest value) _(field)_
- `mode` — Direction _(field)_
- `overflow` — Value already at or over the width _(field)_
- `non_numeric` — Cell that is not plain digits _(field)_
- `header` — First row is a header (never rewritten) _(field)_
- `quote_style` — Output quoting _(field)_

## Output

- Fixed table (text)

## Query parameters

Open the tool pre-filled and auto-run via URL:

- `input` — CSV / TSV table, or one ID per line
- `delimiter` — Delimiter (or 'auto' to detect)
- `columns` — Only these columns (names or 1-based positions; blank = all)
- `width` — Target width (0 = auto-fit each column to its widest value)
- `mode` — Direction
- `overflow` — Value already at or over the width
- `non_numeric` — Cell that is not plain digits
- `header` — First row is a header (never rewritten)
- `quote_style` — Output quoting

Example: `https://gizza.ai/tools/zero-pad-ids/?input=id%2Cname%0A42%2Cada%0A7%2Clinus%0A12345%2Cgrace&delimiter=comma&columns=id&width=5&mode=pad&overflow=keep&non_numeric=keep&header=true&quote_style=minimal`

---

## About this tool

Zero Pad IDs repairs the identifier column that was accidentally treated as a
number. If a spreadsheet, export job, or database loader turned `00042` into
`42`, paste the CSV/TSV table here, choose the affected column, and pad it back
to the required width without changing the rest of the row.

Worked example: with `columns = id` and `width = 5`, this input:

```csv
id,name
42,ada
7,linus
12345,grace
```

becomes:

```csv
id,name
00042,ada
00007,linus
12345,grace
```

Use `width = 0` to auto-fit each selected column to its widest eligible value,
`mode = strip` to remove leading zeros instead, and `quote_style = always` when a
downstream spreadsheet needs every padded code to look explicitly like text.
Inputs are capped at 5,000,000 bytes. Blank cells are left blank, and real digits
are never truncated to make an over-wide value fit.

## FAQ

<details>
<summary>How do I select the ID column?</summary>

With `header` enabled, use column names such as `id`, `zip`, or `account`. You
can also use 1-based positions such as `1` or `1,3`. Leaving `columns` blank
rewrites every column, which is useful for a one-ID-per-line list but risky for a
table that also contains prices or counts.

</details>

<details>
<summary>What does width 0 do?</summary>

`width = 0` means auto-fit. Each selected column is padded to the length of its
widest eligible value, so `42`, `7`, and `12345` become `00042`, `00007`, and
`12345` without you having to know the target width ahead of time.

</details>

<details>
<summary>Will it corrupt alphanumeric codes or blank cells?</summary>

By default, no. Blank cells stay blank, and values that are not plain digits,
such as `SKU-9`, `N/A`, `-42`, or `1.5`, are copied through unchanged. Set
`non_numeric = pad` only when you intentionally want to pad alphanumeric codes.

</details>

<details>
<summary>How do I stop spreadsheets from removing the zeros again?</summary>

Set `quote_style = always` so every output field is quoted, then import the
column as text in your spreadsheet or loader. Quoting helps many readers preserve
the string form, but a program that forcibly casts the field to a number can
still remove leading zeros.

</details>

## Related tools

- [Extract Action Items from Meeting Notes](https://gizza.ai/tools/action-item-extractor/): Extract action items, owners, and decisions from meeting notes or daily notes with deterministic rules. Markdown checklist or JSON, private in-browser.
- [Add Line Numbers](https://gizza.ai/tools/add-line-numbers/): Add line numbers to every line of text online, like nl or cat -n — custom start, step, separator, and alignment. Free and private, runs in your browser.
- [ANSI Log Renderer](https://gizza.ai/tools/ansi-log-renderer/): Paste ANSI-colored terminal output or CI logs and render them as HTML, or strip escape codes to plain text. Handles 16-color, 256-color, and truecolor SGR codes.
- [API response diff](https://gizza.ai/tools/api-response-diff/): Compare two JSON API responses and see only the meaningful changes: ignore request ids, timestamps and UUIDs, match arrays by key or as sets, export a JSON Patch.
- [Rust AST Diff](https://gizza.ai/tools/ast-diff/): Compare two Rust source snippets structurally. The tool parses both files, canonicalizes their ASTs, and ignores formatting, whitespace, and comments.
