Tekst · verktøy

Sammenlign tekstforskjeller

Lim inn en original og en endret versjon for å finne ulike linjer lokalt.

Kjøres i nettleseren. Ingen opplasting.

Comparison runs locally line by line.

Differences0
No comparison yet.

Om verktøyet

Sammenlign tekstforskjeller sem complicação.

Nyttig for å sammenligne utkast, kode, konfigurasjonsfiler og kopierte dokumenter uten å laste opp noen av versjonene.

Veiledning

Slik bruker du Sammenlign tekstforskjeller

This page compares two pieces of text and lists the lines that are different. You paste the first version in the left box and the second version in the right box, then press the Compare button. Two tick boxes let you ignore spaces at the start and end of each line, and ignore capital letters. It helps when you edit a draft, check a settings file, or look at two copies of a list. It judges whole lines only. It does not point to the changed words inside a line, open files, or merge two versions into one. The texts are compared on your device.

Slik gjør du

  1. Paste the older or first version into the box called Original text.
  2. Paste the newer or second version into the box called Changed text.
  3. Tick Trim spaces if extra spaces at the start or end of a line, or repeated spaces between words, should not count as a change. Tick Ignore case if capital letters should not count.
  4. Press Compare text. The Differences number shows how many lines differ, and the list below shows each one.
  5. Read each entry. It starts with a line number, then a line that begins with a minus sign for the original and a line that begins with a plus sign for the changed text.
  6. If you edit a box or a tick box, the old result is cleared. Press Compare text again to see an updated list. Press Clear to empty both boxes.

Eksempler

One line was replaced

Du skriver inn
Opprinnelig
apples bananas cherries
Endret
apples blueberries cherries
Du får
Forskjeller
1
Liste
Line 2: - bananas + blueberries

The first and third lines match. Only the second line differs, so there is one difference, shown with the old line after the minus and the new line after the plus.

Kjørt med verktøyets egen kode.

A new line added at the top

Du skriver inn
Opprinnelig
a b c d
Endret
x a b c d
Du får
Forskjeller
1
Liste
Line 1: - (empty) + x

The page matches the unchanged lines first, so the four old lines are not all reported as changed. Only the new line x is listed, and (empty) means the original has no line there.

Kjørt med verktøyets egen kode.

Ignore case switched on and off

Du skriver inn
Opprinnelig
Name: Ana City: Lyon
Endret
name: ana city: LYON
Du får
Med ignorering av store/små bokstaver
0
Uten ignorering av store/små bokstaver
2

The two versions differ only in capital letters. With Ignore case ticked they count as the same, and with it off both lines are listed as different.

Kjørt med verktøyets egen kode.

Spaces at the ends and spaces inside

Du skriver inn
Opprinnelig
hello there world
Endret
hello there world
Fjern overflødige mellomrom
ja
Du får
Forskjeller
0

Trim spaces removes spaces at the start and end of each line and turns repeated spaces or tabs between words into one space. With the box unticked, the same two texts show 1 difference.

Kjørt med verktøyets egen kode.

One line becomes three lines

Du skriver inn
Opprinnelig
a b c
Endret
a X Y Z c
Du får
Forskjeller
3
Liste
Line 2: - b + X Line 3: - (empty) + Y Line 4: - (empty) + Z

One old line was swapped for three new ones. The count is the larger side of the change, which is three. The extra lines are paired with (empty) and numbered after line 2.

Kjørt med verktøyets egen kode.

A hidden empty line at the end

Du skriver inn
Opprinnelig
a b
Endret
a b
Du får
Forskjeller
1
Liste
Line 3: - (empty) + (empty)

A final line break creates an empty third line in the original. Both sides show (empty), which looks odd, but the real difference is that the original has one more empty line.

Kjørt med verktøyets egen kode.

Når det er nyttig

  • Compare two drafts of an email, an essay or a post to see which lines you rewrote.
  • Check a copied settings file or a short code snippet against the version you started with.
  • Find the line that changed between two versions of a list, such as names, prices or tasks.
  • Confirm that a pasted copy of a document matches the original, line by line.
  • Check whether two exports of the same data are the same after you clean them up.
  • Review changes in a lesson plan or a script before you send the new version to others.

Begrensninger

  • Only whole lines are compared. If one word changes in a long line, the whole line is listed, and the changed word is not highlighted.
  • The line number refers to the original text. For a line that was only added, it shows the place where it would go, which can be past the last original line.
  • Trim spaces removes spaces and tabs at the start and end of each line and turns repeated spaces or tabs between words into one space. Different kinds of quote mark or dash still count as changes.
  • The word (empty) is used for both a missing line and a real empty line, so a difference between those two cases can be hard to tell apart.
  • Very large or very different texts can take too long. After a couple of seconds of work, the page stops and asks you to compare smaller sections.
  • You cannot open a file here. Paste the text into the boxes, and the page cannot merge, save or export the result.

Tips

  • Split long documents into sections and compare them one at a time. This is faster and the list is easier to read.
  • If two texts look the same but show a difference, check for a final empty line, extra spaces, tabs, or a different kind of apostrophe or quote mark.
  • Windows and Mac or Linux line endings are treated as the same, so a copy from another system does not show false differences.
  • Use Ignore case when comparing names or labels typed by different people, and leave it off when capitals matter, as in code.
  • Put the older text on the left and the newer on the right every time, so minus always means removed and plus always means added.
  • Press Compare text again after you change a box or a tick box, because the old result is cleared as soon as you edit.

Kilder

Vanlige spørsmål

Sobre Sammenlign tekstforskjeller.

How do I compare two versions of a text?

Paste the first version into Original text and the second into Changed text. Choose the Trim spaces or Ignore case options if you need them, then press Compare text. The page shows how many lines differ and lists them one by one.

Does it show which words changed inside a line?

No. It compares whole lines. If a single word is different, the full old line and the full new line are shown, and you need to spot the changed word yourself. It does not mark letters or words within a line.

If I add a line in the middle, does everything below it show as changed?

No. The page lines up the matching lines before it reports changes, so one added line gives one difference. It uses a standard shortest-edit method called the Myers algorithm, in a code library named jsdiff.

What does the number after Line mean?

It is the line number in the original text where the change starts. For lines that were only added, it is the place in the original where they would be inserted, so the number can be higher than the number of original lines.

Why does it say (empty)?

The word (empty) fills the empty side of a pair. If a line was added, the original side shows (empty). If a line was deleted, the changed side shows it. It is also shown for a real blank line.

Does Trim spaces ignore all extra spaces?

It ignores spaces and tabs at the start and end of each line, and it treats a run of spaces or tabs between words as one space. It does not remove blank lines and it does not make different quote marks or dashes equal.

How does Ignore case treat letters like ß?

It turns both lines to lower case using the rules of the page language before it compares. Because of that, Straße and STRASSE still count as different: the first becomes straße and the second becomes strasse.

Why do two texts that look the same show a difference?

Common causes are a blank line at the end, spaces at the end of a line, tabs instead of spaces, or curly quotes in place of straight ones. Tick Trim spaces to remove the effect of extra spaces and tabs at the ends of lines and between words; a blank line at the end still counts.

Is there a limit on the size of the texts?

There is no fixed length. The work is done in the background, and if it takes more than a couple of seconds the page stops and asks you to try smaller sections. Texts that are very different from each other take longest.

Are my texts uploaded?

No. The comparison runs in your browser, in a background worker on your device, and neither text is sent to a server. The status line on the page says that the comparison runs locally.

Can I compare two files or merge two versions?

The page has no file picker, so you paste the text instead. It also has no merge or save function. It only lists the lines that differ, and you apply the changes yourself in your editor.

Hvordan bruker du Tekstsammenligner?

Lim inn en original og en endret versjon for å finne ulike linjer lokalt.

Lastes dataene mine opp til en server?

Nei. Behandlingen skjer i nettleseren din, og opplysningene dine lastes ikke opp.