CRLF ↔ LF Converter | Fix Line Ending Issues

ConverterRuns in Your Browser (No Uploads)
Loading…

Convert line endings between Windows (CRLF), Unix/Linux/macOS (LF), and classic Mac (CR). Auto-detect mixed endings and normalize to one style to eliminate Git warnings and shell errors. Private, instant, in-browser processing.

How to Use This Tool

  1. 1

    Choose a mode: CRLF → LF, LF → CRLF, or Auto Detect (best for mixed files).

  2. 2

    Paste or type your text (code, configs, logs).

  3. 3

    Live mode updates results instantly; use Manual mode for large inputs.

  4. 4

    Review CRLF/LF/CR counts and preview the normalized output.

  5. 5

    Copy or download the converted text for your target OS.

Use Cases & Examples

Resolving Git Line Ending Warnings & Errors

Normalize files and enforce a single policy so diffs, merges, and CI work consistently across OSes.

Fixing Shell Scripts for Unix/Linux Execution

Convert Windows-saved shell scripts to LF to fix /bin/bash^M and parsing issues on Linux.

Cross-Platform File Compatibility

Ensure files created on one OS run correctly on another by converting endings on demand.

Development Team Standardization

Adopt an LF-in-repo policy and keep editors aligned via .editorconfig and .gitattributes.

Line Endings at a Glance

Windows uses CRLF (\r\n); Unix/Linux/macOS use LF (\n); classic Mac used CR (\r). Mixing styles can break tools, patching, and scripts.

Git normalization can be enforced with core.autocrlf and .gitattributes rules; many teams store LF in the repo and convert on checkout.

Some protocols (e.g., HTTP headers) require CRLF, while source files in cross-platform repos typically standardize on LF.

Frequently Asked Questions

Q.What about files with mixed line endings? How do I fix them?

A. Use Auto Detect to normalize by the dominant ending, or explicitly choose a target (LF or CRLF) and run a one-click conversion.

Q.How do I resolve Git line ending warnings and errors?

A. Add rules in .gitattributes (e.g., text eol=lf) and set core.autocrlf as needed. Then normalize your files and commit the changes.

Q.Why do shell scripts fail on Linux with "bad interpreter" or syntax errors?

A. Windows editors save CRLF; Linux shells expect LF. Convert scripts to LF and ensure the shebang line uses LF to prevent /bin/bash^M errors.

Q.What are the differences between CRLF, LF, and CR? Which should I use?

A. Windows uses CRLF, Unix/Linux/macOS use LF, and classic Mac used CR. For cross-platform repos, store LF in Git and convert on checkout if required.

Related Tools

Explore more developer tools

Browse All Tools