A line break looks the same on every screen, but it is stored in different ways depending on where the text was created.
The three conventions
| Name | Characters | Escape | Used by |
|---|---|---|---|
| LF (line feed) | U+000A | \n | Linux, macOS, Unix, most web and programming tools |
| CRLF (carriage return + line feed) | U+000D U+000A | \r\n | Windows, many internet protocols (HTTP headers, email) |
| CR (carriage return) | U+000D | \r | Classic Mac OS before OS X |
The names come from typewriters and teleprinters: a carriage return moved the print head back to the start of the line, and a line feed advanced the paper.
Problems they cause
- Stray characters: Windows text opened in some Unix tools shows
^Mat line ends, which is the visible carriage return. - Failed comparisons: “apple\r” and “apple” are different strings, so deduplication or matching can fail on files with mixed endings.
- Noisy version control: a file whose line endings change shows every line as modified. Git’s
core.autocrlfsetting and.gitattributesfiles manage this. - Scripts that won’t run: a shell script saved with CRLF endings may fail on Linux with a confusing error.
- CSV imports: a stray CR can end up inside the last field of every row.
How TexaDocBase handles them
Every tool on this site converts CRLF and CR to LF before processing, so all three conventions are counted and cleaned the same way. A Windows line break counts as one character in the Character Counter, and the Line Counter gives the same result regardless of where the text came from. Output uses LF line breaks, which every modern editor, including Windows Notepad, displays correctly.
Other “line breaks”
Unicode also defines a line separator (U+2028) and paragraph separator (U+2029), and some documents contain vertical tabs or form feeds. These are rare in everyday text; if lines behave strangely after pasting from an unusual source, one of these may be the cause.