CRLF and LF refer to the invisible characters that mark the end of a line in a text file. LF (Line Feed, character U+000A, written \n) is the Unix, Linux, and macOS convention, using a single character. CRLF (Carriage Return plus Line Feed, \r\n) is the Windows convention, using two characters. These historical differences trace back to typewriters and early teletype machines.
The distinction is normally invisible but becomes very real when files move between operating systems. A file created on Windows opened in an older Unix tool may show stray carriage-return characters, while a Unix file opened in basic Windows editors may display as one long line with no breaks. Modern editors handle both, but scripts, parsers, and diff tools can behave unexpectedly when line endings are mixed.
Line endings frequently cause headaches in version control and collaboration. A commit that changes every line ending from LF to CRLF creates a massive, meaningless diff that obscures real changes. This is why tools like Git offer settings to normalize line endings, and why teams standardize on one convention — usually LF — through configuration files to keep repositories clean.
Line endings also matter in data processing. Some protocols and formats explicitly require CRLF — HTTP headers and the SMTP email protocol, for example — while many programming tools default to LF. When parsing CSV or log files, inconsistent or unexpected line endings can create phantom blank lines or fields with trailing carriage returns, so normalizing them is a common cleanup step before processing.