Line Ending Converter
Detect and convert line endings between CRLF (Windows), LF (Unix / Linux / macOS), CR (Classic Mac OS), and other formats. Visualise every line break, load files via drag-and-drop, and export in multiple formats — all client-side, free, and private.
Last updated: July 26, 2026
How to Use the Line Ending Converter
- Load your text. Either type or paste content directly into the Input panel on the left, or drag a plain-text file onto the drop zone at the top of the tool. The tool accepts any text-based format — source code in any language, shell scripts, configuration files, CSV data, Markdown documents, or raw log output. When a file is loaded via drag-and-drop, it is read entirely in browser memory using the FileReader API; nothing is transmitted to any server at any stage.
- Read the auto-detected statistics. As soon as text appears in the input panel, the six statistic cards update automatically. They show the total line count, character count, and a precise breakdown of how many CRLF, standalone LF, and standalone CR sequences are present. The Detected card summarises the dominant line-ending style — if your file is pure LF, it says "LF"; if it is mixed, it says "Mixed". This diagnosis is the starting point for understanding what needs to change and why.
- Choose your target line-ending format. Open the "Convert to" dropdown and select the destination format. The seven options cover every line-ending convention in active use: LF for Unix and modern macOS, CRLF for Windows and network protocols, CR for Classic Mac OS legacy files, LFCR for RISC OS or parser testing, NUL-terminated for C string workflows and shell tools like xargs -0, VT for terminal control sequences, and FF for form-feed separators used in some editors and printers.
- Configure trailing-newline and mixed-ending behaviour. The "Trailing newline" dropdown lets you preserve the existing behaviour, enforce a newline at the very end of the file (required by POSIX and expected by many compilers and linters), or strip it entirely for systems that cannot tolerate a trailing blank line. The "Mixed-ending handling" dropdown lets you normalise all endings to LF first before applying the target conversion — this is the safest approach for files with inconsistent endings, as it eliminates any ambiguity in the byte sequence before the final transformation.
- Click Convert and review the output. The output panel on the right receives the converted text immediately. The output metadata line beneath the panel label confirms the target format and the exact number of line endings written. If the input was empty, a descriptive error message appears beneath the buttons explaining what to do — the tool never silently produces empty output without explanation.
- Use the Visualiser to inspect individual line breaks. Click the Visualise button to open the line-ending visualiser, which renders your input text with each line terminator replaced by a visible colour-coded tag. A file with mixed endings will show both [CRLF] and [LF] tags on different lines, making it immediately obvious which lines are affected. The visualiser works on the input text and is independent of the conversion — you can visualise before and after by swapping the panels.
- Export in the format your workflow requires. The export section provides eight download options. Choose the file extension that matches your use case: .txt for documentation, .sh for shell scripts, .py for Python source, .js for JavaScript, .csv for spreadsheet data, .xml for markup files, .md for Markdown, or the JSON report which packages the full conversion metadata including original and target format, counts, and a timestamp. You can also copy the converted text directly to your clipboard using the Copy Output button.
Why Use Our Line Ending Converter?
The line ending converter problem is deceptively common. A developer working on Windows checks out a repository, edits a shell script, and pushes it back — only to find that the CI pipeline on a Linux server fails immediately because the script now contains CRLF line endings and the shebang line is interpreted incorrectly. A data engineer receives a CSV file exported from a Windows application and finds that every row in their Python parser is off by one field because the CRLF sequence is being split differently than expected. A technical writer pastes Markdown into a static site generator and discovers that certain heading-level breaks are being collapsed because the tool expected LF but received CR. These are not edge cases — they are regular occurrences in any cross-platform workflow, and fixing them manually is error-prone because most text editors do not show line endings by default. The Thefreeaitools line ending converter makes the invisible visible and fixes it in seconds.
The detection and statistics engine is the feature that distinguishes this tool from a simple find-and-replace operation. Before you convert anything, the tool counts every CRLF, LF, and CR sequence independently and shows the breakdown in real time. A file that appears to have 500 lines might contain 498 LF endings and 2 CRLF endings — a ratio that a bulk "convert CRLF to LF" command would handle correctly but that you would never know existed without the count. Knowing the exact composition of your file before converting is what allows you to choose the right handling strategy: convert all endings uniformly, or normalise to a common baseline first and then convert to the target. The tool makes both paths explicit and controllable.
Coverage of all seven line-ending formats — not just the three most common — reflects the reality that developers working with legacy systems, embedded firmware, binary protocols, and specialised editors encounter formats beyond CRLF and LF with some regularity. The NUL-terminated export, for example, is not a curiosity: it is essential for anyone building pipelines that use xargs -0 or find -print0 to safely handle filenames with spaces. The Form Feed (0x0C) separator is still the canonical section divider in many Python source files and is recognised by Vim's CTRL-L display. The Vertical Tab (0x0B) appears in some legacy word processor formats and ANSI escape sequences. Having all seven in one tool eliminates the need to hunt for a specialist converter when working outside the mainstream three.
Privacy is a real requirement for this tool's primary audience — developers — who routinely work with source code, configuration files, environment variables, API keys in .env files, and proprietary business logic. Sending those files to a server-based converter creates a data exposure risk that many organisations actively prohibit under their security policies. Because every operation in this tool happens inside the browser using JavaScript string manipulation on locally held data, there is zero network exposure. The FileReader API loads your file into browser memory directly; no upload occurs. The export functions generate files from in-memory strings using the Blob API and trigger a client-side download. The entire round-trip from input to output to download never involves a network packet containing your content.
Worked Example
Scenario: Fixing a mixed-ending shell script that fails on a Linux CI server
A developer on Windows has edited a deployment script, deploy.sh, using Notepad. The file originally had LF endings but Notepad has silently converted some lines to CRLF. The script now fails on the Ubuntu CI runner with: bash: ./deploy.sh: /bin/bash^M: bad interpreter.
| Setting | Input state | Chosen value |
|---|---|---|
| File loaded | deploy.sh — 47 lines | Dragged onto drop zone |
| Detected | Mixed (44 LF + 3 CRLF) | Read from stats bar automatically |
| Convert to | — | LF — Unix / Linux / macOS |
| Mixed-ending handling | — | Normalise to LF first, then convert |
| Trailing newline | — | Ensure trailing newline (POSIX compliance) |
Output: The output panel shows 47 lines with 47 LF endings (0 CRLF, 0 CR). The output metadata reads: "LF — 47 line endings". The developer clicks "Download .sh", receives deploy.sh with correct LF endings, replaces the file in the repository, and the CI pipeline passes on the next push. Total time to diagnose and fix: under 90 seconds. Without the visualiser showing which specific lines held the CRLF sequence, the developer would have needed to open the file in a hex editor or run cat -A deploy.sh | grep '\^M' in a terminal to identify the affected lines.
Common Mistakes When Working With Line Endings
- Relying on a text editor's "Convert Line Endings" menu without verifying the result. Many editors show a line-ending mode indicator in the status bar, but they display the dominant format of the file, not a guarantee that every line conforms. A file that Visual Studio Code reports as "LF" at the bottom may still contain a handful of CRLF sequences inherited from a copy-paste operation. Use the statistics panel of this tool to verify the actual count of each sequence before treating a file as clean.
- Converting binary files or files with embedded null bytes. This converter is designed for plain-text content. Binary files — compiled executables, images, audio, encrypted archives — contain arbitrary byte sequences that include 0x0D and 0x0A as data, not as line separators. Running a line-ending conversion on a binary file will corrupt it by altering those bytes. Always confirm that a file is pure text before converting; the character count and line count in the statistics bar will appear unreasonably high for binary content loaded accidentally.
- Forgetting that Git's autocrlf setting can undo your conversion. If you fix a file's line endings manually, commit it, and then check it out on a machine where core.autocrlf=true is set in Git, Git will silently convert the endings back on checkout. The correct long-term fix is to add a .gitattributes file to your repository specifying explicit line-ending rules per file type (e.g., *.sh text eol=lf) so that Git's behaviour is deterministic regardless of the client machine's configuration. Use this converter to fix the immediate problem and then address the root cause in your repository settings.
- Using CRLF line endings in shell scripts deployed to Linux. The CRLF pattern is perfectly valid in a Windows .bat or .ps1 file, but a Bash script with CRLF endings will fail on Linux because the \r byte is treated as part of the command name, not as whitespace. The error message (bad interpreter: /bin/bash^M) is the tell-tale sign. Convert to LF before deploying any shell script to a Unix-based server, container, or CI runner.
Privacy and Security
The Line Ending Converter processes your text exclusively within your own browser. When you paste text into the input panel or drag a file onto the drop zone, the content is held in browser memory as a JavaScript string — it is never transmitted to Thefreeaitools's servers, never passed to a third-party service, and never written to any database or log. The conversion itself is a series of JavaScript string replacement operations (String.replace() with regular expressions targeting specific byte patterns) that execute in microseconds on the local CPU. The file export functions create a Blob object in memory and offer it as a download through a temporary object URL that is revoked immediately after the download dialog opens. At no point does any network request carry your file content.
Thefreeaitools.com is delivered exclusively over HTTPS, which means the page code itself arrives at your browser over an encrypted connection authenticated by a valid TLS certificate. This protects the integrity of the tool code — you can be confident that what runs in your browser is what Thefreeaitools published, not a modified version injected in transit. Combined with the client-side-only processing architecture, this makes the tool appropriate for use with source code containing credentials, configuration files with connection strings, proprietary business logic, or any other content that your organisation's security policy requires to remain on-device. There is nothing to delete, nothing to request removal of, and no session data that persists after you close the browser tab.