النص
Text Diff
مقارنة نصين سطرًا بسطر — ما تمت إضافته أو حذفه أو تغييره، مع تمييز على مستوى الكلمة في الأسطر التي تغيرت.
Text Diff compares two texts line by line and shows what was added, removed, or changed, with word-level highlighting inside changed lines — much like git diff, but without a command line.
How to use it
- Paste the original text into one field and the changed version into the other.
- The result immediately highlights added lines, removed lines, and the words that changed within shared lines.
- Handy for scanning large texts — jump straight to the first differences instead of searching manually.
Common uses
- Comparing two versions of a document, article, or config file without installing git.
- Checking exactly what changed in a text after an editor or an automatic formatter touched it.
- Comparing API responses or logs between two runs.
Things to keep in mind
By default a whitespace-only change (like indentation) still counts as a difference, since it technically changes the line's content.
The diff compares lines by position, so adding or removing a single line near the top can shift how the rest of the text lines up.
مقالة عن هذه الأداة: Text Diff: كيف تعمل خوارزمية إيجاد الفروقات بين النصوص
الأسئلة الشائعة
كيف تتم المقارنة بين النصين؟
المقارنة تتم سطرًا بسطر، فتُحدَّد الأسطر المُضافة والمحذوفة والمُعدَّلة، وداخل كل سطر تغيّر يُضاف تمييز على مستوى الكلمة لإظهار الجزء الذي تغيّر بالضبط.
كيف تظهر الإضافات والحذف والتعديلات في النتيجة؟
الأسطر المُضافة والمحذوفة تُعرض بشكل منفصل ضمن ملخص الاختلافات، بينما الأسطر التي تغيّر جزء منها فقط تُعرض مع تمييز الكلمات المتغيرة داخلها دون باقي السطر.
هل النصان اللذان ألصقهما يُرسلان إلى أي خادم؟
لا، المقارنة تتم بالكامل داخل متصفحك عبر JavaScript، ولا يُرسل أي من النصين إلى خادم.
لماذا يظهر إدراج سطر واحد وكأنه غيّر كل الأسطر التالية؟
الخوارزمية لا تتعرف دائمًا بدقة على أن هذا إدراج فقط، لا استبدال جماعي — خصوصًا إذا كانت الأسطر المجاورة متشابهة فيما بينها. تحاول خوارزميات الديف الجيدة تقليل هذه الإيجابيات الخاطئة عبر البحث عن أطول تتابع مشترك (LCS)، لكن النتيجة ليست مثالية دائمًا.
هل تُؤخذ المسافات البيضاء بعين الاعتبار عند المقارنة؟
نعم، افتراضيًا يُعتبر تغيير المسافات البيضاء وحده (مثل الإزاحات) اختلافًا أيضًا، لأنه تقنيًا تغيير في محتوى السطر.