Teks
CRLF ↔ LF Converter
Mengonversi akhir baris antara Windows (CRLF), Unix/macOS (LF), dan Mac klasik (CR), dengan deteksi akhir baris campuran.
Browser secara otomatis menormalkan teks yang ditempel di kolom ini menjadi LF, sehingga CRLF/CR asli tidak dapat terdeteksi di sini — untuk menganalisis atau mengonversi file dengan CRLF/CR asli, gunakan unggah file di atas.
Windows, Unix/macOS, and the old classic Mac historically use different characters to mark the end of a line — CRLF, LF, and CR respectively. Mixing these styles in one file often causes odd artifacts in diffs or editors. This tool converts line endings to one style and detects mixed ones.
How to use it
- Paste text and the tool automatically detects the current line-ending style, including a mixed one.
- Pick a target format (CRLF, LF, or CR) and the conversion happens instantly.
- If several styles are found in the same file, that's flagged with a separate warning.
Common uses
- Fixing a file where git diff shows every line as changed because of differing line endings, even though the content itself didn't actually change.
- Converting a text file to the format a specific system or script expects (a Unix script, for instance, expects LF).
- Debugging why a file opened in a Windows editor shows the entire text on one line (a sign of plain LF with no CR).
Things to keep in mind
Git can automate this conversion itself through core.autocrlf or .gitattributes — often more convenient than converting files in a repository by hand.
Mixed line endings in one file aren't always visible at a glance, but they can break parsers or scripts that expect one specific style.
Artikel tentang alat ini: CRLF vs LF: mengapa karakter akhir baris masih penting
Pertanyaan yang sering diajukan
Mengapa akhir baris berbeda menurut sistem?
Windows menggunakan CRLF (\r\n), Unix dan macOS menggunakan LF (\n) saja, dan Mac klasik menggunakan CR (\r) saja — konvensi historis yang berbeda ini menyebabkan inkonsistensi saat file berpindah antar sistem.
Mengapa saya perlu mengunggah file alih-alih menempel teks?
Browser secara otomatis menormalkan teks apa pun yang ditempel ke bidang input menjadi LF, sehingga karakter CRLF atau CR asli yang sebenarnya menjadi tidak terdeteksi setelah ditempel — hanya unggahan file langsung yang mempertahankan akhir baris sebenarnya untuk analisis atau konversi.
Kapan masalah semacam ini benar-benar penting?
Ini paling penting dengan git (diff berisik yang disebabkan oleh akhir baris), skrip shell yang gagal karena sisa CRLF, dan file yang dipertukarkan antara sistem Windows dan Unix/macOS; file yang diunggah hanya diproses secara lokal di browser, tidak pernah dikirim ke server.
Bagaimana jika sebuah berkas memiliki CRLF dan LF yang tercampur?
Berkas yang diedit di beberapa editor atau OS berbeda bisa berisi kedua gaya sekaligus. Konversi harus diterapkan ke seluruh berkas, bukan hanya baris yang tampak "mencurigakan" — jika tidak, sebagian akhir baris yang bermasalah akan tetap tidak terdeteksi.
Apakah konversi bisa diotomatisasi melalui git?
Ya, pengaturan core.autocrlf di git secara otomatis mengonversi akhir baris saat checkout dan commit, dan .gitattributes memungkinkan Anda menentukan gaya akhir baris secara eksplisit untuk jenis berkas tertentu dalam repositori.