# Text line endings normalize

`text-line-endings-normalize` · version 1.0.0 · Text · free, no key needed

Normalize all line endings in a text to a specific format (LF, CRLF, or CR).

**Use when you need to: text line endings normalize · normalize line endings · convert crlf to lf.**

## Supported

- text line endings normalize
- normalize line endings
- convert crlf to lf
- convert lf to crlf

## Not supported

- unicode normalization
- whitespace trimming
- read files

## Behavior

- Replaces all line ending sequences (CRLF, CR, LF) that do not match the requested format.
- format can be "lf", "crlf", or "cr". Default is "lf".
- Returns the normalized text and the number of line endings that were modified.

## Input

- `text` (string, required): max length 1048576
- `format` (one of "lf", "crlf", "cr", optional)

## Output

- `text` (string, required): max length 2097152
- `replacements` (integer, required): min 0

## Limits

- max text bytes: 1048576
- max output bytes: 2097152

## Example

Request input:

```json
{
  "text": "Line 1\r\nLine 2\rLine 3\n",
  "format": "lf"
}
```

Response:

```json
{
  "result": {
    "text": "Line 1\nLine 2\nLine 3\n",
    "replacements": 2
  }
}
```

## How to call it

### MCP

Connect `https://computefirst.net/mcp` ([setup](/docs#connect)), then call `execute` with:

```json
{
  "id": "text-line-endings-normalize",
  "version": "1.0.0",
  "input": {
    "text": "Line 1\r\nLine 2\rLine 3\n",
    "format": "lf"
  }
}
```

### HTTP (no key)

```sh
curl -X POST https://computefirst.net/v1/tools/text-line-endings-normalize/versions/1.0.0/execute \
  -H "Content-Type: application/json" \
  -d '{"text":"Line 1\r\nLine 2\rLine 3\n","format":"lf"}'
```

The machine-readable contract is at [/v1/tools/text-line-endings-normalize/versions/1.0.0](/v1/tools/text-line-endings-normalize/versions/1.0.0).

### CLI

```sh
node cli.mjs run text-line-endings-normalize 1.0.0 --input input.json --base-url https://computefirst.net
```

Get the client at [/clients/cli/](/clients/cli/).

## Related tools

- [Text tabs to spaces](/tools/text-tabs-to-spaces): Convert tab characters to spaces.
- [Text apply unified patch](/tools/text-apply-unified-patch): Apply a one-file unified patch to text at original line addresses with exact hunk matches.
- [Text diff stats](/tools/text-diff-stats): Summarize a line-record diff as keep, insert, delete, and hunk counts.
- [Text line diff](/tools/text-line-diff): Diff two texts as line records, preserving each line terminator.
- [Text lines count](/tools/text-lines-count): Count exact line multiplicities in first-seen order.
- [Text lines difference](/tools/text-lines-difference): Set difference a minus b using exact line equality.
