# Inspect text file encoding and line endings

Check encoding hints, BOM bytes, line-ending style, line counts, longest lines, whitespace, indentation and control characters in pasted text.

## Run it

- **CLI:** `gizza tool text-file-inspector "Paste file contents here…
Line two with spaces   
	Indented line"`
- **Web:** https://gizza.ai/tools/text-file-inspector/
- **Agents:** machine-readable descriptor (parameters JSON Schema) at https://gizza.ai/tools/text-file-inspector/tool.json

## Inputs

- `input` — Text to inspect _(field)_
- `output` — Output _(field)_
- `longest_lines` — Longest lines to list _(field)_
- `max_line_length` — Flag lines over _(field)_
- `preview_lines` — Preview lines _(field)_

## Output

- Inspection report (text)

## Query parameters

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

- `input` — Text to inspect
- `output` — Output
- `longest_lines` — Longest lines to list
- `max_line_length` — Flag lines over
- `preview_lines` — Preview lines

Example: `https://gizza.ai/tools/text-file-inspector/?input=Paste%20file%20contents%20here%E2%80%A6%0ALine%20two%20with%20spaces%20%20%20%0A%09Indented%20line&output=report&longest_lines=3&max_line_length=0&preview_lines=0`

---

## About this tool

Text files fail in quiet ways: a CSV looks fine until a parser sees mixed CRLF and LF, a script has a UTF-8 BOM before its shebang, or a generated file is one giant line with no final newline. This inspector gives you the status-bar and linter facts in one report: detected encoding, BOM presence, line-ending style, line count, longest lines, trailing whitespace, tab/space indentation and control-character counts.

On this page, paste text directly. The CLI and chat tool can inspect exact file bytes with `input_format=base64` or `input_format=hex`, which is the right path when you need to preserve a BOM, CRLF endings or legacy encodings exactly.

Example CLI use with exact file bytes:

```bash
gizza tool text-file-inspector input="$(base64 -w0 README.md)" input_format=base64 max_line_length=120 preview_lines=3
```

The tool diagnoses only; it never rewrites the file. Use an editor, formatter or `text-encoding-converter` when you want to change encodings or line endings.

## FAQ

<details>
<summary>Why does pasted text not show my original CRLF endings or BOM?</summary>

Browsers and terminals often normalize pasted text before JavaScript sees it, and a normal text field cannot carry a file's byte-order mark. Use the CLI with `input_format=base64` for exact byte-level inspection of a real file.

</details>

<details>
<summary>What does MIXED line endings mean?</summary>

The input contains more than one terminator style, such as both CRLF and LF. That can create noisy Git diffs and can break scripts or old parsers that expect one style throughout the file.

</details>

<details>
<summary>Can this convert the file to UTF-8 or normalize line endings?</summary>

No. This block is read-only and reports what is present. Use the report to decide what to fix, then convert with your editor, formatter, or a dedicated encoding/line-ending conversion tool.

</details>

<details>
<summary>Why does the report mention a missing final newline?</summary>

Many POSIX tools and linters expect text files to end with a newline. A missing final newline is not always fatal, but it can produce warnings and awkward diffs when another tool appends to the file.

</details>

## Related tools

- [Colorize Text with Regex Rules](https://gizza.ai/tools/text-colorizer/): Highlight log or command output with user-defined regex color rules, then export ANSI terminal escapes or self-contained HTML.
- [Text Diff](https://gizza.ai/tools/text-diff/): Compare two text blocks and highlight added, removed, and changed lines.
- [Text to Unicode](https://gizza.ai/tools/text-to-unicode/): List each character's Unicode code point (U+XXXX), name, \u escape sequence and UTF-8 bytes for any text.
- [Unicode to Text](https://gizza.ai/tools/unicode-to-text/): Decode Unicode escape sequences back into readable text. Auto-detects \uXXXX, \u{X}, \xXX, \U00XXXXXX, U+XXXX and HTML &#nn; / &#xnn; in one pass.
- [Merge Two Lists & Remove Duplicates](https://gizza.ai/tools/list-dedupe-merge/): Merge two lists into one deduplicated list and see how many overlaps were collapsed. Append or interleave, ignore case, trim, and sort. Runs in your browser.
