I have a file that contains "mixed" line-endings, i.e. both LF and CRLF. This is because the file is a mixture of plain text that also has binary data interspersed.

I'm looking for a text editor that doesn't normalize line-endings whenever saving (i.e. leaves the newlines unchanged in the file). It seems most/all text editors convert all new-lines in a file to be the same after the first time you save.

Normally I'd use a Hex editor for this, but in this case I have to mostly edit the text and make changes on a per-line basis and I also don't know of a hex editor that shows text with new-lines for editing (i.e. splits the rows on newlines).

Another implied requirement is that the editor shouldn't affect any parts of the file that weren't edited, e.g. by re-encoding etc., but I've found this is usually only an issue with these files when UTF-8 (or any variable length) encoding is assumed by the editor, so setting the encoding to e.g. ISO 8859-1 seemed to work to prevent this.

Text editors I've tried: nano (see mail), xed, Visual Studio Code (see github issue), Sublime Text (see discussion)

Hex editors I've tried: GHex, Bless Hex Editor, Okteta, wxhexeditor

2 Answers 2


CudaText is free and multi-platform, it supports mixed line endings. Also it don't break binary files on saving, including all text files. https://wiki.freepascal.org/CudaText#Line_ends

I recommend to use its feature to show text labels for line endings: "LF", "CR", "CRLF". You can turn it on using option "unprinted_content" or using View top menu.


vi seems to leave unedited newlines unchanged when saving and only makes the minimal changes to a file being edited (although it does require learning a whole "new" editing/interaction paradigm).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.