ASCII code for Enter
ASCII codes for Enter: CR (13), LF (10), and CRLF (13+10). Learn how different operating systems represent line breaks and how to type them.
Enter / line-break ASCII specification
Version 1.0.0 · Last reviewed 2026-07-28
- Definition
- Enter/newline uses ASCII control codes LF (10) and/or CR (13). Windows typically uses CRLF; Unix and modern macOS use LF.
- What it calculates
- Documents ASCII control codes for Enter/line breaks: LF (10), CR (13), and CRLF (13+10) across OS conventions.
- Inputs
- Reference lookup for Enter / newline control characters
- Outputs
- LF \n = 10 / 0x0A
- CR \r = 13 / 0x0D
- CRLF \r\n = 13,10 (Windows)
- Formula
Unix/macOS: LF(10); Windows: CR(13)+LF(10); classic Mac: CR(13)Pressing Enter inserts a line break. ASCII defines two control characters involved: LF (Line Feed, 10) and CR (Carriage Return, 13). Different systems combine them differently.
ASCII codes
Name Character Decimal Hex Description LF \n10 0A Line Feed — move to next line CR \r13 0D Carriage Return — move to start of line CRLF \r\n13, 10 0D 0A Windows/DOS line ending LF only \n10 0A Unix/Linux/macOS line ending CR only \r13 0D Old Mac (pre-OS X) line ending Line ending conventions
System Line ending Bytes Windows CRLF \r\n(13, 10)Linux / macOS LF \n(10)Classic Mac OS CR \r(13)How to type / represent
Context Enter / new line Keyboard Enter or Return key C/C++ string \n(LF) or\r\n(CRLF)HTML new line <br>(not an ASCII control char in HTML text)HTML entity (LF) HTML entity (CR) Escape sequences \x0A(LF),\x0D(CR)FAQ
What is the ASCII code for Enter?
Enter typically sends CR (13) or CRLF (13+10) depending on the terminal or OS. In C strings,
\n(LF, 10) is the standard newline escape.Why do Windows and Linux text files differ?
Historical convention: Windows uses CRLF (
\r\n); Unix/Linux uses LF (\n) only. Tools likedos2unixconvert between formats.What is
\r\nin code?Carriage Return + Line Feed — the two-byte Windows/DOS line ending sequence.
Can a file mix CR and LF line endings?
Yes, though it causes inconsistent behavior in some editors. Normalize with
dos2unixor your editor's line-ending setting.What ASCII code does the Enter key send?
Terminals often send CR (13) or LF (10). Raw keyboard scan codes differ from the ASCII character stored in a text file.
- Assumptions
- LF and CR are ASCII control characters (not printable glyphs).
- Modern macOS uses LF like Unix; classic Mac OS used CR alone.
- Reference page; conventions follow common text-file practice.
- Units
- Dec / Hex control codes
- Escape: \n / \r / \r\n
- Boundary conditions
- Enter is not a single universal ASCII printable code.
- Mixed line endings can break parsers that expect one convention.
- Example
- Windows Enter → CRLF (13,10); Unix Enter → LF (10)
- Validation cases
- LF → 10 / 0x0A / \n
- CR → 13 / 0x0D / \r
- Windows line ending → CRLF 13,10
- Unix/macOS line ending → LF 10
- Sources
- ANSI X3.4 ASCII control codes CR/LF
- Common text-file line-ending conventions (CRLF / LF / CR)
- Last reviewed
- 2026-07-28
- Calculation version
- 1.0.0