Text File Portability Preflight

Paste or upload a plain text file and see exactly which encoding, line-ending and whitespace quirks will make it behave differently in Git, diff tools, CI systems, Windows Notepad or older Unix tools — even though it looks completely normal in your own editor.

Processed locally in your browser. Your file is never uploaded.

How to use this calculator

  1. Paste text, or upload a .txt/.csv/.log/plain-text file — nothing leaves your browser.
  2. Select "Check portability".
  3. Review each flagged issue: what makes it a portability problem, and which tools it actually affects.
  4. Use the combined safe rewrite where offered — it normalizes line endings, strips a leading BOM, trims trailing whitespace, adds a missing final newline, and fixes whitespace look-alikes all at once.

Assumptions

Methodology

The text is split into lines while recording each line's own original terminator (CRLF, bare LF, bare CR, or none), which is what makes mixed-line-ending detection possible without a normalizing split throwing that information away. Each of the eight rules is then a targeted, documented check against that line/character-level data. A combined rewrite is offered only for the issues that have a mechanically safe, unambiguous fix — line-ending normalization, BOM-stripping, trailing-whitespace trimming, adding a missing final newline, and whitespace look-alike substitution/removal. Replacement characters (no fix possible — the data is already gone) and mixed tab/space indentation (the correct fix depends on an intended tab-width convention this tool can't know) are flagged only, never auto-rewritten.

Worked example

A file edited on both Windows and Unix, mixing CRLF and LF line endings

Inputs: line one\r\nline two\n

Result: Git and other line-based diff tools compare lines byte-for-byte, so every line can show as changed even when only one line's content actually changed — flagged as an error, with a safe rewrite normalizing everything to LF.

A leading UTF-8 byte order mark before a shebang line

Inputs: \uFEFF#!/bin/sh\necho "Hello"

Result: A BOM before "#!/bin/sh" stops many Unix shells from recognising it as a shebang at all. Flagged as a warning; safely rewritten by stripping the leading BOM.

A non-breaking space (U+00A0) copy-pasted in place of a regular space

Inputs: const total = price + tax;

Result: Looks identical to a normal space in most editors and fonts, but exact-match parsing and comparison treat it as a different character. Flagged as a warning; safely rewritten to a regular ASCII space.

Practical guidance
Common mistakes

FAQs

Why are mixed line endings and bare CR both errors, but trailing whitespace only info?

Mixed or bare-CR line endings make line-based tools (Git, diff, many parsers) misread the file's actual structure — that's a functional problem, not a style preference. Trailing whitespace is invisible and harmless to read; it only becomes noisy when it passes through a formatter or linter inconsistently, which is a much smaller, informational concern.

Why doesn't this tool fix mixed tab/space indentation automatically?

Converting correctly requires knowing whether the file's intended indent unit is, say, 2 or 4 or 8 columns per tab — a convention this tool has no way to infer from the text alone. Guessing wrong would silently change the file's visual structure, so it's flagged with exact line numbers instead.

Can this tool detect what encoding my file was actually saved in?

No — by the time this tool sees the text, your browser has already decoded the file's bytes into a JavaScript string using its own encoding guess (or the encoding you told it to use). This tool can only spot a decode failure after the fact, via the Unicode replacement character it leaves behind; it can't inspect the original raw bytes.