Line Ending Converter Convert between line endings: LF (Unix), CRLF (Windows), CR (Classic Mac).
Line Ending Converter
Convert between line endings: LF (Unix), CRLF (Windows), CR (Classic Mac).
Paste Text
Paste text with line endings to convert.
Select Target Line Ending
Choose the target line ending: LF, CRLF, or CR.
Copy Converted Text
Copy the text with converted line endings.
What Is Line Ending Converter?
A Line Ending Converter is a utility that changes the line break characters in text between the three major formats: LF (\n, used by Unix/Linux/modern macOS), CRLF (\r\n, used by Windows), and CR (\r, used by Classic Mac OS). Developers working on cross-platform projects use it to fix compatibility issues when moving code or data between operating systems. One specific problem it solves is the inconsistent line breaks that occur when transferring text files from a Windows system to a Unix-based system, which can lead to formatting errors or compilation issues.
The tool normalizes all line endings to LF before converting to the target format, ensuring consistency in the output. This process involves replacing CRLF and CR characters with LF using regular expressions, as seen in the code's `onProcess` function. What makes this tool different is its ability to convert between these formats using a simple radio button selection, allowing users to choose from LF, CRLF, or CR targets.
It also provides an input field for pasting text and an output label to display the converted text, making it easy to use for tasks like crlf to lf or lf to crlf conversions. By providing this functionality, the tool helps resolve common issues with line endings, such as fixing crlf line endings in code files, and can be used as a newline converter or line break converter for various text processing needs, including how to convert line endings in different operating systems.
Why Use Line Ending Converter?
-
Fix line ending issues when moving files between OS platforms
-
Standardize line endings for cross-platform projects
-
Convert Windows CRLF to Unix LF or vice versa
-
Resolve Git and version control line ending conflicts
Common Use Cases
Cross-platform Development
Normalize line endings when collaborating across Windows, Mac, and Linux.
Git Issues
Fix line ending conflicts in version-controlled files.
File Transfer
Convert line endings after transferring files between operating systems.
Script Compatibility
Ensure shell scripts use LF line endings for Unix compatibility.
Technical Guide
The converter uses a two-step process. First, all line endings are normalized to LF (\n) by replacing CRLF (\r\n) first, then replacing any remaining CR (\r). CRLF must be replaced first to prevent creating double LF. After normalization, the tool converts LF to the target format: for CRLF, LF becomes \r\n; for CR, LF becomes \r; for LF, no further conversion is needed. This approach handles mixed line endings in the input correctly, producing consistent output regardless of the input format.
Tips & Best Practices
-
1LF (\n) is the standard for Unix, Linux, and modern macOS
-
2CRLF (\r\n) is the standard for Windows
-
3CR (\r) was used by Classic Mac OS 9 and earlier
-
4Most modern editors handle both LF and CRLF, but scripts may require specific endings
Related Tools
Tab to Spaces Converter
Convert tab characters to spaces with configurable tab width.
📝 Text Tools
Find and Replace
Find and replace text with support for regex, case sensitivity, and bulk operations.
📝 Text Tools
Remove Extra Spaces
Remove extra whitespace — collapse multiple spaces to single spaces.
📝 Text Tools
Whitespace Visualizer
Make invisible whitespace characters visible with symbolic markers.
📝 Text ToolsFrequently Asked Questions
Q What is the difference between LF and CRLF?
Q What line ending format should I use?
Q Can it handle mixed line endings?
Q Does converting line endings change how the text looks?
Q How do I know which line endings my text has?
About This Tool
Line Ending Converter is a free online tool by FreeToolkit.ai. All processing happens directly in your browser — your data never leaves your device. No registration or installation required.