What is CR (carriage return)? A control character that returns the character input position to the beginning of the line

Explanation of IT Terms

What is Carriage Return (CR)?

Carriage Return (CR) is a control character used in computer systems and text processing to indicate the end of a line and return the input position to the beginning of the line. It is represented by the ASCII value 13 or the Unicode value U+000D.

In the context of text files or documents, a linebreak is typically represented by a combination of the Carriage Return (CR) and Line Feed (LF) control characters. In this combination, the CR character precedes the LF character, and together they signify the end of a line and the start of a new one.

How Carriage Return Works

When a CR character is encountered in a text document or input stream, the associated software or application interprets it as a command to move the cursor or print head to the start of the current line. This action effectively enables overwriting or appending content at the beginning of the line.

In computing, the Carriage Return character finds its origins in earlier mechanical typewriters. These machines used a physical carriage that held the paper and moved it horizontally to align the next character to be printed in the correct position. The Carriage Return command caused the carriage to return to the leftmost position, ready for the next line of text.

While modern computer systems have replaced physical carriages with electronic representations, the concept of the Carriage Return remains relevant for maintaining compatibility with legacy text formats and protocols.

Usage and Examples

Carriage Return is commonly used in various text-based systems and protocols, including:

1. Text Editors: In many text editors and word processors, pressing the Enter or Return key results in the insertion of a Carriage Return (CR) and Line Feed (LF) combination. This starts a new line for the user to continue typing.

2. Terminal Emulation: When using terminal emulation software to connect to remote systems or servers, the Carriage Return (CR) character is often used to send commands or text input to the remote device. It instructs the terminal to return the input position to the beginning of the line before sending the entered text.

3. File Formats: Several file formats, such as the classic Macintosh text files (.txt) and early versions of Microsoft Windows text files, used only the Carriage Return (CR) character to delimit lines. These formats have largely been replaced by the common usage of the CR-LF combination.

In summary, Carriage Return (CR) is a control character used to indicate the end of a line in text-based systems. Its primary function is to return the input position to the beginning of the line, allowing for the insertion or overwriting of content.

Reference Articles

Reference Articles

Read also

[Google Chrome] The definitive solution for right-click translations that no longer come up.