टेक्स्ट
CRLF ↔ LF Converter
लाइन एंडिंग को Windows (CRLF), Unix/macOS (LF) और क्लासिक Mac (CR) के बीच कन्वर्ट करें, मिश्रित एंडिंग की पहचान के साथ।
ब्राउज़र फ़ील्ड में पेस्ट किए गए टेक्स्ट को खुद LF में नॉर्मलाइज़ कर देता है, इसलिए यहाँ ओरिजिनल CRLF/CR पहचानना संभव नहीं है — असली CRLF/CR वाली फ़ाइल का विश्लेषण या कन्वर्ज़न करने के लिए ऊपर दिए गए फ़ाइल अपलोड का उपयोग करें।
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.
इस टूल के बारे में लेख: CRLF और LF: लाइन एंडिंग अब भी समस्याएँ क्यों पैदा करती हैं
अक्सर पूछे जाने वाले प्रश्न
सिस्टम के अनुसार लाइन एंडिंग्स अलग क्यों होती हैं?
Windows CRLF (\r\n) इस्तेमाल करता है, Unix और macOS सिर्फ़ LF (\n) इस्तेमाल करते हैं, और क्लासिक Mac सिर्फ़ CR (\r) इस्तेमाल करता था — ये अलग-अलग ऐतिहासिक परंपराएं तब असंगति पैदा करती हैं जब फ़ाइल एक सिस्टम से दूसरे में जाती है।
टेक्स्ट पेस्ट करने के बजाय मुझे फ़ाइल अपलोड क्यों करनी होगी?
ब्राउज़र किसी इनपुट फ़ील्ड में पेस्ट किए गए किसी भी टेक्स्ट को स्वतः LF में सामान्य कर देता है, इसलिए असली मूल CRLF या CR कैरेक्टर पेस्ट होते ही अज्ञात हो जाते हैं — केवल सीधा फ़ाइल अपलोड ही विश्लेषण या कन्वर्जन के लिए उसकी वास्तविक लाइन एंडिंग्स सुरक्षित रखता है।
यह समस्या वास्तव में कब मायने रखती है?
यह सबसे ज़्यादा git के साथ मायने रखती है (लाइन एंडिंग्स के कारण शोरगुल भरे diffs), बचे हुए CRLF के कारण फ़ेल होने वाले shell स्क्रिप्ट्स के साथ, और Windows तथा Unix/macOS सिस्टम्स के बीच एक्सचेंज होने वाली फ़ाइलों के साथ; अपलोड की गई फ़ाइल केवल ब्राउज़र में स्थानीय रूप से प्रोसेस होती है, कभी सर्वर पर नहीं भेजी जाती।
अगर फ़ाइल में CRLF और LF मिश्रित हों तो क्या करें?
कई एडिटर या अलग-अलग OS पर एडिट की गई फ़ाइल में दोनों स्टाइल एक साथ मौजूद हो सकते हैं। कन्वर्ज़न पूरी फ़ाइल पर लागू करना ज़रूरी है, सिर्फ़ दिखने में "संदिग्ध" लाइनों पर नहीं — वरना कुछ समस्याग्रस्त एंडिंग बिना पहचाने रह जाती हैं।
क्या git के ज़रिए कन्वर्ज़न को ऑटोमेट किया जा सकता है?
हाँ, git में <code>core.autocrlf</code> सेटिंग checkout और commit पर लाइन एंडिंग को अपने आप कन्वर्ट कर देती है, और <code>.gitattributes</code> रिपॉज़िटरी में किसी ख़ास फ़ाइल टाइप के लिए एंडिंग स्टाइल स्पष्ट रूप से तय करने देता है।