Condense a log file to shorten it for ChatGPT

Strip colour codes and timestamps, collapse repeated lines and keep the errors. See how much shorter the log got.

How it works

  1. Paste the log
  2. Choose what to strip, collapse or keep
  3. Copy the condensed log and check the before and after counts

What it does to a log

To shorten a log for ChatGPT, this tool removes colour codes, strips the timestamps at the start of each line, merges runs of identical lines into one line with a count, and can keep only the error lines with some context around them. Escape codes such as colours and cursor moves are always removed, including ones that lost their escape byte when copied, like [32m or [0m. Timestamps in ISO 8601 form, syslog form (Oct 5 09:00:01), [bracketed] form and Apache form are cut when Remove leading timestamps is on, because lines that differ only by time cannot merge. Only consecutive lines merge, so a line that comes back later is kept where it is.

Repeats, similar lines and errors

With default options, six lines of 2026-10-15T09:00:01Z INFO Heartbeat ok to 09:00:06 become one line, INFO Heartbeat ok (repeated 6 times). That takes the text from 233 to 36 characters and the rough token estimate from 59 to 9. Switch on Treat numbers, hex and ids as the same to merge lines that differ only in numbers, 0x values, long hex strings or UUIDs, such as GET /items/101 and GET /items/102; the first line is kept and the note says the numbers differ. Keep only error and warning lines keeps any line that contains error, warn, fatal, fail, exception, panic, critical, denied, refused, timeout, abort or traceback, plus the chosen number of lines of context on each side, and writes [... 12 lines omitted ...] where lines were left out.

Head, tail and the token estimate

First lines, Last lines and First and last cut the result to a number of lines, after everything else, and say how many lines were left out. The token figure is a rough estimate: characters divided by 4 and rounded up, based on the published rule of thumb of about 4 characters per token for English text. Logs full of paths, ids and symbols often use more tokens per character than prose, so the real count can be higher. Use the figure to compare before and after, and check the limit of the tool you paste into.

Limits and what to check

Condensing is lossy: the count replaces the repeated lines, and timestamps are gone unless you switch them off, so keep the original log when the timing matters. The error filter works on words, so a line such as no errors found is kept, and an error message that avoids those words is not. Context lines are counted after repeated lines are merged. Chat tools and coding agents have a limit on how much text they read at once, and a shorter log leaves room for your question. Input is limited to 2,000,000 characters.

Frequently asked questions

How do I shorten a log file for ChatGPT?

Paste the log, leave Remove leading timestamps on, and copy the result. Repeated lines merge, so 6 identical heartbeat lines become one line with (repeated 6 times). For a long log, also switch on Keep only error and warning lines and set 2 lines of context.

How do I remove ANSI colour codes from a log?

Paste it. Colour codes such as ESC[31m and ESC[0m are always removed, and so are codes that lost their escape byte, like [32m. A copy from a terminal can leave them as text such as [0;32m.

Why are my repeated lines not merging?

Only consecutive lines merge, and they must match after cleaning. Lines that differ by a timestamp, a request number or an id stay apart. Turn on Remove leading timestamps for the first, and Treat numbers, hex and ids as the same for the others.

How accurate is the token estimate?

It is a rough estimate: characters divided by 4, based on the rule of thumb of about 4 characters per token for English text. A 4,000 character log shows as 1,000 tokens. Logs full of ids and paths can use more, so treat it as a way to compare before and after.

Can I keep only the lines around an error?

Yes. Switch on Keep only error and warning lines and pick 0 to 20 lines of context. With 2 lines of context, a stack trace that starts right after an error line is kept in part. Omitted stretches are replaced with a line such as [... 40 lines omitted ...].

Is my log uploaded?

No. It is processed in your browser, in this tab, and no server receives it. Your choices are saved in this browser, the log is not. Check the condensed text for passwords and tokens before you paste it anywhere, because this tool does not hide them.