ASCII Enter Character (Line Feed)
The Enter character, technically called Line Feed (LF), has ASCII code 10. It creates a new line in text and is essential for formatting multi-line content in programming and text processing.
Newline Character Visualization
The newline character creates line breaks in text:
Line 1↵
Line 2↵
Line 3
Red dashed boxes with arrows represent newline characters
Character Information
| Property | Value |
|---|---|
| ASCII Code (Decimal) | 10 |
| ASCII Code (Hexadecimal) | 0A |
| ASCII Code (Binary) | 0001010 |
| Unicode | U+000A |
| HTML Entity | or 
 |
| Escape Sequence | \n |
| Character Name | Line Feed (LF) |
| Character Type | Control Character, Whitespace |
Line Ending Types
| System | Line Ending | ASCII Codes | Escape Sequence |
|---|---|---|---|
| Unix/Linux/macOS | Line Feed (LF) | 10 | \n |
| Windows | Carriage Return + Line Feed (CRLF) | 13 + 10 | \r\n |
| Classic Mac (pre-OS X) | Carriage Return (CR) | 13 | \r |
Programming Examples
JavaScript
// Creating newlines
let newline = '\n'; // Line feed
let text = "Line 1\nLine 2\nLine 3"; // Multi-line string
let fromCode = String.fromCharCode(10); // From ASCII code
// Working with newlines
let lines = text.split('\n'); // Split on newlines
console.log("Hello\nWorld"); // Print with newline
let joined = lines.join('\n'); // Join with newlines
let newline = '\n'; // Line feed
let text = "Line 1\nLine 2\nLine 3"; // Multi-line string
let fromCode = String.fromCharCode(10); // From ASCII code
// Working with newlines
let lines = text.split('\n'); // Split on newlines
console.log("Hello\nWorld"); // Print with newline
let joined = lines.join('\n'); // Join with newlines
Python
# Creating newlines
newline = '\n' # Line feed
text = "Line 1\nLine 2\nLine 3" # Multi-line string
from_code = chr(10) # From ASCII code
# Working with newlines
lines = text.split('\n') # Split on newlines
print("Hello\nWorld") # Print with newline
joined = '\n'.join(lines) # Join with newlines
newline = '\n' # Line feed
text = "Line 1\nLine 2\nLine 3" # Multi-line string
from_code = chr(10) # From ASCII code
# Working with newlines
lines = text.split('\n') # Split on newlines
print("Hello\nWorld") # Print with newline
joined = '\n'.join(lines) # Join with newlines
C/C++
// Creating newlines
char newline = '\n'; // Line feed
char newline_code = 10; // From ASCII code
char* text = "Line 1\nLine 2\nLine 3"; // Multi-line string
// Working with newlines
printf("Hello\nWorld\n"); // Print with newlines
if (ch == '\n') { // Check for newline
// Handle newline character
}
char newline = '\n'; // Line feed
char newline_code = 10; // From ASCII code
char* text = "Line 1\nLine 2\nLine 3"; // Multi-line string
// Working with newlines
printf("Hello\nWorld\n"); // Print with newlines
if (ch == '\n') { // Check for newline
// Handle newline character
}
Common Uses
- Text Formatting: Creating paragraphs and line breaks in documents
- Code Structure: Separating lines of code for readability
- Data Files: Delimiting records in text-based data formats
- Console Output: Formatting terminal and console output
- File Processing: Reading and writing multi-line text files
- Web Development: Creating line breaks in HTML and text content
- Configuration Files: Separating configuration entries
Cross-Platform Considerations
- Git: Automatically handles line ending conversions
- Text Editors: Most modern editors handle different line endings
- Programming: Use language-specific newline constants when possible
- File Transfer: Be aware of line ending changes when moving files
- Web Forms: HTML forms may send different line endings