How To Make Correct Line Endings | Hacker Noon

Author profile picture

@wagslaneLane Wagner

Bitcoinist, libertarian, atheist, cryptography fan, and founder of

Ever had the problem where you submit a pull request and the diff is waaaaay bigger than it should be? The code looks identical but GitHub is telling you that it’s all different! This is typically due to a difference in line endings. Unix systems (Linux and Mac) default to the LF (line feed) character for line breaks. Windows on the other hand is “special” and defaults to CR/LF (carriage return AND line feed).

The Quick Fix

If you are here to quickly fix a single file that you are having problems with, you are in luck. At the bottom right of the screen in VS Code there is a little button that says “LF” or “CRLF”:

Click that button and change it to your preference. Voila, the file you are editing now has the correct line breaks.

The Big Fix

If you want new files to automatically have the correct line endings, then you can set the following setting in the top level of your settings.json file:

For LF:

    "files.eol": "n",


    "files.eol": "rn",

If you set it in your global settings.json file it will apply to your entire machine. If you just want it set for the project you are working on, then edit the settings.json in the .vscode directory at the root of your project. .vscode/settings.json

Note: This setting will not automatically fix all files in your project that have the wrong line endings! It only applies to new ones. To fix the old ones go through and use the manual method.

Thanks For Reading

Follow us on Twitter @q_vault if you have any questions or comments

Take game-like coding courses on Qvault Classroom

Subscribe to our Newsletter for more educational articles

Previously published at


The Noonification banner

Subscribe to get your daily round-up of top tech stories!

read original article here