Back
Asciify Logo
Asciify

Line Feed

LF (Line Feed) is ASCII code point 10 (0x0A), Unicode U+000A, and a control character. If you're seeing `^M` at the end of every line or a shell script that fails for no apparent reason, you're dealing with a line-ending mismatch — and LF is at the center of it. It moves the cursor down one line and is the standard line terminator on Unix, Linux, and macOS. The split happened decades ago and never healed: Unix uses bare `\n`, Windows uses `\r\n`. This mismatch silently corrupts diffs, breaks scripts, and confuses editors. Git manages it with `core.autocrlf`, a setting that itself causes confusion. In C-descended languages, `\n` may be translated to the platform's native line ending depending on whether the file was opened in text or binary mode. HTTP and SMTP require `\r\n` regardless of platform. LF originated in teletype practice, where it physically advanced the paper one line — a separate mechanical action from returning the print head to column one, which is why CR and LF both exist and why some systems still require the pair. UTF-8 encodes it as a single byte 0x0A, identical to its ASCII value. Unicode classifies it as Cc (Control, Other) under the official name LINE FEED. One of several Unicode line-ending characters alongside CR (U+000D), NEL (U+0085), and the line and paragraph separators (U+2028, U+2029), though in practice nearly everything on the modern web uses LF alone.

Whitespace

Technical Details

Code Example

</>
char *msg = "GET / HTTP/1.1\nHost: example.com\n\n";
// LF separates header lines in this raw example
int is_lf = (msg[14] == '\n'); // '\n' is ASCII 10

Frequently Asked Questions

  • LF (\n, ASCII 10) is Unix/macOS line ending. CR (\r, ASCII 13) was old Mac (pre-OS X). CRLF (\r\n) is Windows. The difference comes from typewriters: CR returns the carriage to column 1, LF advances the paper. Unix decided one character was enough.

  • It tells Git how to handle line endings. 'core.autocrlf true' converts CRLF to LF on commit and back to CRLF on checkout (for Windows). 'input' converts to LF on commit but keeps LF on checkout (for Mac/Linux). 'false' does nothing, risking mixed line endings.

  • This warning means Git is about to normalize your line endings, which is usually good. To suppress it without changing behavior, set 'core.safecrlf' to false. Ideally, add a .gitattributes file with '* text=auto' to enforce consistent handling across your team.

  • This classic error happens when you try to run a script saved with Windows line endings (CRLF) on Linux/macOS. The shell sees the invisible '\r' as part of the command name. Fix it by running 'dos2unix myscript.sh' or stripping the CR bytes.

  • Because they're invisible. A file with Windows CRLF endings opened on Linux shows ^M characters at line ends. Git diffs show every line as changed. Scripts fail with 'bad interpreter' errors. This single-byte difference has caused millions of hours of debugging.

  • Add a .gitattributes file with '* text=auto' to let Git normalize line endings. Use .editorconfig to set end_of_line for new files. For existing files, tools like dos2unix and unix2dos do batch conversion. The goal is consistency, not a specific style.

  • They're the same thing. ASCII called it Line Feed because it moved paper down one line on a printer. Programming languages adopted \n as the escape sequence. The C standard calls it 'newline' but the underlying byte is still ASCII 10 — just with a friendlier name.

  • Yes. Linux kernel and shell scripts strictly expect LF. If you mount a Windows file into a Docker container or run a CRLF script, it will almost certainly fail. Always ensure entrypoint scripts use LF line endings.

@workani&@alexluthor
Privacy & legal

Privacy

No accounts, no ads, no tracking cookies, and no cross-site tracking. The only analytics we keep are faceless — anonymous, aggregated counts of pages and searches, never tied to you. We store no IP addresses, set no tracking cookies, and build no profiles. Cloudflare hosts the site and handles requests for delivery and security.

Full privacy policy·Extension privacy·legal@asciify.dev

Attributions & licenses

Twemoji
© Twitter, Inc and other contributors · CC-BY 4.0
Noto Color Emoji
© Google · Apache 2.0
Fluent UI Emoji
© Microsoft · MIT
OpenMoji
© HfG Schwäbisch Gmünd · CC-BY-SA 4.0
Toss Face
© Viva Republica (Toss) · SIL OFL 1.1
JoyPixels
© JoyPixels Inc. · Free Limited Use License
SerenityOS Emoji
© The SerenityOS Developers · BSD-2-Clause
EmojiTwo
© EmojiTwo contributors · CC-BY 4.0
Apple Color Emoji
© Apple, Inc.
Facebook Emoji
© Meta Platforms, Inc.

Apple and Facebook emoji styles are proprietary and shown here solely for reference and comparison — a common-sense application of nominative-use / fair-use principles. asciify is not affiliated with, endorsed by, or sponsored by Apple, Inc., Meta Platforms, Inc., or any other rights holder listed above. If a rights holder requests removal of their emoji style from this site, it will be removed.

All other vendor emoji are reproduced for reference and comparison under their respective open licenses listed above.

Character names and code points from the Unicode® Standard. Unicode® and the Unicode Logo are registered trademarks of Unicode, Inc.

Privacy
© asciify.dev 2025-2026