DevTools Logo

Line Ending Converter

Line Ending Converter

Detect and convert CRLF, LF and CR terminators with a byte-for-byte faithful rewrite.

Runs in your browser
Try an example

Text or file

Awaiting inputCounts terminators, not records
SequenceCount
CRLF (\r\n)0
LF (\n)0
CR (\r)0
U+0085 (NEL)0
U+2028 (LS)0
U+2029 (PS)0

Converted text

Add text or a file to detect its line endings

Conversion runs in your browser. Nothing leaves your device.

Details

The detector scans the input once, consuming CRLF atomically so a Windows line break is never counted twice as a lone LF. It reports the exact count of CRLF, LF, CR, U+0085, U+2028 and U+2029 characters before any rewrite runs. The rewriter uses the same priority, so every detected terminator becomes exactly one target terminator and unchanged lines stay byte-for-byte identical. Mixed endings are normalized on request, and the final newline can be kept, ensured, or removed.

More examples

Fix a Windows file for a Unix build

Input:  const port = 5432;
const host = 'db';
Output: const port = 5432;
const host = 'db';

Detection: CRLF 2, LF 0, CR 0 — verdict pure CRLF.

Choosing LF as the target turns every CRLF into one LF and shrinks the file by two bytes.

Normalize a mixed-ending log

Input:  step 1 ok
step 2 ok
step 3 retry
step 4 ok
Detection: CRLF 1, LF 2, CR 1 — verdict mixed.
Output: step 1 ok
step 2 ok
step 3 retry
step 4 ok

A single scan counts each terminator family, and the rewrite emits one LF for every detected break. A warning explains that the lone CR was treated as a line break.

Fold rich-text separators

Input:  Intro
Methods…Results

Fold Unicode separators: on
Output: Intro
Methods
Results

U+2028 and U+0085 are literal characters by default; enabling the fold rewrites them to the chosen target and reports the change.

    Examples

    Convert a Windows file to LF

    Input
    const port = 5432;
    const host = 'db';
    
    Output
    const port = 5432;
    const host = 'db';
    

    Two CRLF terminators become two LF terminators, reducing the UTF-8 size by two bytes.

    Normalize a mixed-ending log

    Input
    step 1 ok
    step 2 ok
    step 3 retry
    step 4 ok
    
    Output
    step 1 ok
    step 2 ok
    step 3 retry
    step 4 ok
    

    The detector reports CRLF 1, LF 2 and CR 1 before the rewrite turns every break into LF.

    Fold Unicode separators in pasted rich text

    Input
    Intro
Methods…Results

    Output
    Intro
    Methods
    Results
    

    With Unicode separator folding enabled, U+2028, U+0085 and U+2029 are emitted as the selected target.

    Use cases

    Fix lint failures after a Windows edit

    Paste a CRLF source file, confirm the pure-CRLF verdict, and convert to LF so a Unix CI runner stops flagging whole-file diffs.

    Ingest an exported CSV into a Linux pipeline

    Upload a Windows-exported CSV, check the detection counts, and rewrite to LF before feeding the file to a shell or Python job.

    Verify what a file actually contains

    Use the detection table as evidence before opening a pull request or filing a bug about unexpected line-ending changes.

    Prepare text for a legacy tool

    Choose CRLF or CR when a downstream system expects Windows or classic Mac OS terminators, and use the byte delta to confirm the expected size change.

    Common mistakes

    Mistake:Assuming a textarea paste preserves the original CRLF bytes.

    Fix:Upload the source file when byte-accurate detection matters; some browsers normalize pasted line endings to LF before JavaScript sees them.

    Mistake:Treating the detector's line breaks as CSV records when a quoted field contains a carriage return.

    Fix:Remember that the counts describe terminators, not parsed records; use a CSV-aware parser for record-level work.

    Mistake:Enabling Unicode separator folding on JavaScript source that legitimately contains U+2028 inside a string literal.

    Fix:Keep the fold toggle off unless the pasted content is rich text; the default leaves those characters untouched.

    Frequently asked questions

    Why does git keep changing my line endings?

    Git normalizes line endings according to core.autocrlf and the .gitattributes rules in your repository. A file edited on Windows can come back as CRLF even if the rest of the project uses LF. Convert the file to the expected ending here, then commit a .gitattributes rule such as * text=auto eol=lf so future checkouts agree. This tool changes the text you paste; it does not edit your git configuration.

    What is the difference between CRLF and LF?

    CRLF is carriage return followed by line feed (bytes 0D 0A) and is traditional on Windows and DOS. LF is a single line feed (byte 0A) used by Unix, Linux and modern macOS. Both mark one line break. Converting CRLF to LF removes one byte per break; converting LF to CRLF adds one. Pure CR (byte 0D) comes from classic Mac OS files before Mac OS X.

    Does this do the same thing as dos2unix?

    For plain text, yes: both rewrite Windows terminators to LF. This page also shows the exact before-and-after counts, handles mixed endings and Unicode separators, and lets you pick LF, CRLF or CR as the target. dos2unix remains useful for batch files and pipelines, especially above this tool's 50 MB limit, where the error message suggests command-line alternatives.

    Are U+2028 and U+0085 real line breaks?

    Unicode defines U+0085 (NEL), U+2028 (line separator) and U+2029 (paragraph separator) as newline-related characters, but most editors and programming languages treat them as ordinary characters. That is why folding is off by default. Turn it on for rich text pasted from other applications; leave it off for source code such as a JavaScript string literal containing U+2028. When folding runs, a warning reports that the original separator characters were replaced.

    Where does my file go, and is the text stored?

    Nothing leaves your browser: detection, conversion, copy and download all run locally, and no file is uploaded. The text you type is kept in this browser's local storage so a refresh does not lose your work, which means browser extensions with page access could still read it. Avoid pasting secrets you would not normally leave in a browser tab, and use the Clear action when you are finished.

    References & standards