PDFのミカタ

行の前後の空白を消す方法

公開日:2026年10月19日|最終更新:2026年10月19日|運営者情報

この記事のポイント
  • 貼り付ける
  • 空白を消す
  • コピーする

コピーしたリストの行頭や行末に、見えない空白が入っていると、同じ内容でも別の行と判断されます。重複した行を消す・並べ替える の「行の前後の空白を消す」で、取り除けます。

手順

  1. 「整える前(1行に1つ)」に、リストを貼り付けます。
  2. 「行の前後の空白を消す」にチェックを入れます。
  3. 必要なら、「重複した行を消す」「空行を消す」も選びます。
  4. 「整えた後」を確認し、「結果をコピー」でコピーします。
行の「前後」の空白を消します。文字と文字のあいだの空白は、消えません。

空白が入る原因

空白の種類

見た目では分かりにくいものがあります。

重複と組み合わせる理由

「山田太郎」と「山田太郎 」(末尾にスペース)は、別の行として扱われ、重複とみなされません。先に空白を消すと、同じ行として、重複を取り除けます。

文字のあいだの空白

行の中の空白を消したいときは、置換機能の付いたテキストエディタや、全角・半角を整えるツールを使います。

向いている場面

例

参加者名簿を2つ合わせたら、重複が見つからなかった。末尾の空白が原因と分かり、「行の前後の空白を消す」を選んだところ、15行の重複が見つかった。

つまずきやすい点

よくある質問

全角スペースも消えますか?

はい。行頭・行末の空白は、全角も含めて取り除かれます。

まとめ

重複チェックの前に、前後の空白を消す。見えない空白が、重複を隠しています。

重複した行を消す・並べ替えるを使う(無料)

あわせて使えるツール

この解説が役に立ったら、応援してもらえるとうれしいです。

応援する(300円)ほしい物リストで応援

同じツールの、ほかの解説

解説の一覧を見る

How to Trim Spaces Around Lines

Published: Oct 19, 2026 | Updated: Oct 19, 2026 | About (Japanese)

Key points
  • Paste
  • Trim spaces
  • Copy

If a copied list has invisible spaces at the start or end of lines, even identical content is judged as different lines. "Remove spaces at the start and end of lines" in Remove Duplicate Lines and Sort a List takes them out.

Steps

  1. Paste the list into "Before tidying (one per line)".
  2. Tick "Remove spaces at the start and end of lines".
  3. If needed, also choose "Remove duplicate lines" and "Remove empty lines".
  4. Check "After tidying" and copy with "Copy result".
It removes spaces at the start and end of lines. Spaces between characters are not removed.

Why spaces get in

Kinds of spaces

Some are hard to see.

Why combine with duplicates

"Yamada Taro" and "Yamada Taro " (trailing space) are treated as different lines and not seen as duplicates. Removing the spaces first makes them the same line so the duplicate can be removed.

Spaces between characters

To remove spaces inside a line, use a text editor with find-and-replace or the tool that tidies full-width and half-width.

Good for

Example

Merging two rosters found no duplicates. Trailing spaces were the cause; after choosing "Remove spaces at the start and end of lines", 15 duplicate lines were found.

Common stumbling blocks

Frequently asked questions

Are full-width spaces removed too?

Yes. Spaces at the start and end of lines, including full-width, are removed.

Summary

Remove surrounding spaces before a duplicate check. Invisible spaces hide duplicates.

Use "Remove Duplicate Lines and Sort a List" (free)

Tools that go well with this

If this guide helped, a small tip would mean a lot.

Send a tip (¥300)Send a gift (Amazon wishlist)

More guides for this tool

See all guides