What are carriage return, linefeed, and form feed?

Carriage return means to return to the beginning of the current line without advancing downward. The name comes from a printer’s carriage, as monitors were rare when the name was coined. This is commonly escaped as “\r”, abbreviated CR, and has ASCII value 13 or 0xD.

Linefeed means to advance downward to the next line; however, it has been repurposed and renamed. Used as “newline”, it terminates lines (commonly confused with separating lines). This is commonly escaped as “\n”, abbreviated LF or NL, and has ASCII value 10 or 0xA. CRLF (but not CRNL) is used for the pair “\r\n”.

Form feed means advance downward to the next “page”. It was commonly used as page separators, but now is also used as section separators. Text editors can use this character when you “insert a page break”. This is commonly escaped as “\f”, abbreviated FF, and has ASCII value 12 or 0xC.


As control characters, they may be interpreted in various ways.

The most important interpretation is how these characters delimit lines. Lines end with NL on Unix (including OS X), CRLF on Windows, and CR on older Macs. Note the shift in meaning from LF to NL, for the exact same character, gives the differences between Windows and Unix, which is also why many Windows programs use CRLF to separate instead of terminate lines. Many text editors can read files in any of these three formats and convert between them, but not all utilities can.

Form feed is much less commonly used. As page separator, it can only come between lines or at the start or end of the file.

Leave a Comment