Carriage return
Encyclopedia
Carriage return, often shortened to return, refers to a control character
or mechanism used to start a new line of text.
Originally, the term "carriage return" referred to a mechanism or lever on a typewriter
. It was used after typing a line of text and caused the assembly holding the paper (the carriage) to return to the right (assuming a left-to-right language), so the machine was ready to type again on the left side of the paper. The lever would also usually advance the paper to the next line. The first power carriage return was added to electric typewriters by Smith Corona
in 1960. The key for this was usually labeled "carriage return" or "return". With typewriters like the Selectric, where the type element was moved when typing and the paper held stationary, the key returned the type element to the left and the term "carrier return" was sometimes used for this function.
To improve the keyboard for non-English-speakers, the symbol (U
+21B5) was introduced to mark this key, since this graphic could communicate the action of the key without using words.
, the carriage return (CR) is one of the control characters in ASCII code
, Unicode
, EBCDIC
, or many other codes. It commands a printer
or other sort of output system such as a display to move the position of the cursor
to the first position on the same line. It was mostly used along with line feed, a move to the next line, so that together they start a new line.
The carriage return and line feed functions were split for two reasons:
As early as 1901 Baudot code
contained separate carriage return and line feed characters.
Many computer programs use the carriage return character, alone or with a line feed, to signal the end of a line of text, but other characters are also used for this function (see newline
); others use it only for a paragraph break (a hard return
). Some standards which introduce their own representations for line and paragraph control (for example HTML
) and many programming languages treat carriage return and line feed as whitespace
.
In ASCII
and Unicode
, the carriage return is defined as 13 (or hexadecimal
0D); it may also be seen as control+M or ^M. In the C programming language
, and many other languages influenced by it,
Control character
In computing and telecommunication, a control character or non-printing character is a code point in a character set, that does not in itself represent a written symbol.It is in-band signaling in the context of character encoding....
or mechanism used to start a new line of text.
Originally, the term "carriage return" referred to a mechanism or lever on a typewriter
Typewriter
A typewriter is a mechanical or electromechanical device with keys that, when pressed, cause characters to be printed on a medium, usually paper. Typically one character is printed per keypress, and the machine prints the characters by making ink impressions of type elements similar to the pieces...
. It was used after typing a line of text and caused the assembly holding the paper (the carriage) to return to the right (assuming a left-to-right language), so the machine was ready to type again on the left side of the paper. The lever would also usually advance the paper to the next line. The first power carriage return was added to electric typewriters by Smith Corona
Smith Corona
Smith Corona or the SCM Corporation is a US typewriter and calculator company. Once a large U.S. manufacturer, the company experienced sales declines in typewriters in the mid-1980s due to the introduction of PC-based word processing...
in 1960. The key for this was usually labeled "carriage return" or "return". With typewriters like the Selectric, where the type element was moved when typing and the paper held stationary, the key returned the type element to the left and the term "carrier return" was sometimes used for this function.
To improve the keyboard for non-English-speakers, the symbol (U
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...
+21B5) was introduced to mark this key, since this graphic could communicate the action of the key without using words.
Computers
In computingComputing
Computing is usually defined as the activity of using and improving computer hardware and software. It is the computer-specific part of information technology...
, the carriage return (CR) is one of the control characters in ASCII code
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...
, Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...
, EBCDIC
EBCDIC
Extended Binary Coded Decimal Interchange Code is an 8-bit character encoding used mainly on IBM mainframe and IBM midrange computer operating systems....
, or many other codes. It commands a printer
Computer printer
In computing, a printer is a peripheral which produces a text or graphics of documents stored in electronic form, usually on physical print media such as paper or transparencies. Many printers are primarily used as local peripherals, and are attached by a printer cable or, in most new printers, a...
or other sort of output system such as a display to move the position of the cursor
Cursor (computers)
In computing, a cursor is an indicator used to show the position on a computer monitor or other display device that will respond to input from a text input or pointing device. The flashing text cursor may be referred to as a caret in some cases...
to the first position on the same line. It was mostly used along with line feed, a move to the next line, so that together they start a new line.
The carriage return and line feed functions were split for two reasons:
- Carriage return by itself provided the ability to overprint the line with new text. This could be used to produce bold, underscores, accented characters, strike out text, and some symbols.
- Early mechanical printers were too slow to return the carriage in the time it took to process one character. Therefore the time spent sending the line feed was not wasted (often several more characters had to be sent to ensure the carriage return had happened before sending a printing character). This is why the carriage return was always sent first.
As early as 1901 Baudot code
Baudot code
The Baudot code, invented by Émile Baudot, is a character set predating EBCDIC and ASCII. It was the predecessor to the International Telegraph Alphabet No 2 , the teleprinter code in use until the advent of ASCII. Each character in the alphabet is represented by a series of bits, sent over a...
contained separate carriage return and line feed characters.
Many computer programs use the carriage return character, alone or with a line feed, to signal the end of a line of text, but other characters are also used for this function (see newline
Newline
In computing, a newline, also known as a line break or end-of-line marker, is a special character or sequence of characters signifying the end of a line of text. The name comes from the fact that the next character after the newline will appear on a new line—that is, on the next line below the...
); others use it only for a paragraph break (a hard return
Hard return
A hard return is a paragraph break in a word processor. It differs from a soft return in that it starts a new paragraph. Besides affecting the document statistics, this means that:*Often, extra space and a first line indent will be inserted....
). Some standards which introduce their own representations for line and paragraph control (for example HTML
HTML
HyperText Markup Language is the predominant markup language for web pages. HTML elements are the basic building-blocks of webpages....
) and many programming languages treat carriage return and line feed as whitespace
Whitespace (computer science)
In computer science, whitespace is any single character or series of characters that represents horizontal or vertical space in typography. When rendered, a whitespace character does not correspond to a visual mark, but typically does occupy an area on a page...
.
In ASCII
ASCII
The American Standard Code for Information Interchange is a character-encoding scheme based on the ordering of the English alphabet. ASCII codes represent text in computers, communications equipment, and other devices that use text...
and Unicode
Unicode
Unicode is a computing industry standard for the consistent encoding, representation and handling of text expressed in most of the world's writing systems...
, the carriage return is defined as 13 (or hexadecimal
Hexadecimal
In mathematics and computer science, hexadecimal is a positional numeral system with a radix, or base, of 16. It uses sixteen distinct symbols, most often the symbols 0–9 to represent values zero to nine, and A, B, C, D, E, F to represent values ten to fifteen...
0D); it may also be seen as control+M or ^M. In the C programming language
C (programming language)
C is a general-purpose computer programming language developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the Unix operating system....
, and many other languages influenced by it,
\r
denotes this character.