Question: > 
> **Possible Duplicate:**  
> 
> [What is the difference between \r and \n?](https://stackoverflow.com/questions/1279779/what-is-the-difference-between-r-and-n) 
> 
> 
> 

Hi,

What is difference between `\n` (newline) and `\r` (carriage return)? They both move current cursor to the next line. Are they same?

Answer: 
I suggest you read [this](http://en.wikipedia.org/wiki/Newline#Representations).

In short, a newline in Windows is `"\r\n"`, while a newline in Unix is just `"\n"` (and, just to make life difficult, a newline in older Macs is `"\r"`)
No they're not. Modern text editors often treat them the same however because their old uses don't make much sense for digital word processors.

For example `\r` literally means "return to the beginning of the line". While this might have been useful for a typewriter if you just wanted to overwrite everything on that line this sort of functionality doesn't make much sense for digital type.

`\n` on the other hand would simply move down a line without returning to the beginning. This was also useful on a typewriter for indentation or bulleting. Again, not something that makes much sense for digital type. 

Telnet is one example where both characters are still used in this manner.

Both characters were included in ascii language simply because when it was being spec'd they hadn't realized that functionality that was useful on a typewriter didn't make much sense on a computer.