What is line ending rules (CRLF vs LF)?
15
01-Feb-2026
Updated on 01-Feb-2026
Anubhav Kumar
01-Feb-2026Line ending rules define how a new line is represented at the end of each line in a text file.
In short:
\n)Used by Linux and macOS
\r\n)Used by Windows
Why it matters
Different operating systems use different line endings. If not handled properly, this can cause:
How Git helps
Using
.gitattributes, Git can:This keeps code consistent across platforms.