FIRST CH TOOLS / Text / 63 LINE TOOLS
Text Line Tools: Remove Duplicates, Sort & Number Lines
Tidy a list with one item per line: remove duplicate lines, sort, shuffle, number the lines, drop blank lines, trim spaces and add a prefix or suffix to every line. Only the steps you tick are applied, once each and always in the same order, so "trim, then remove duplicates, then sort, then number" is a single pass. Sorting compares numbers by value: item2 comes before item10, and -5 before 1.5.
Ticked steps run from top to bottom
This tool works line by line. Character-level conversion such as making full-width ABC and half-width ABC match belongs to the Full-width ⇄ Half-width Converter; to see how two lists differ, use the Diff Checker.
How to Use
- Paste the listOne item per line in the left-hand box — a column copied out of a spreadsheet or a list of URLs pulled from a log works as it is.
- Tick the stepsChoose any of 01–06. Buttons such as "Dedupe & sort" switch on a common combination in one click. The result on the right updates with every change.
- CopyTake the right-hand box back to where the list came from. The lines that were duplicated, with their counts, and any near-duplicates that slipped through are listed under Checks.
Order of operations and sorting rules
Steps run 01 → 06, once each
Whatever order you tick them in, the steps always run spaces → blank lines → duplicates → order → prefix & suffix → line numbers. Trimming comes first, so "apple" and "apple␣" are removed as duplicates; numbering comes last, so the numbers run 1, 2, 3… in the sorted order. With both a prefix and numbers, the number goes outside: 1. - apple.
Number-only lines sort by value; other lines compare their digit runs as numbers
With "compare numbers by value" on, lines that are just a number (-10, 1.25, 1,000, full-width 12) are ordered by value and placed before lines containing text. Other lines treat each run of digits as one number, giving item1 → item2 → item10. Switch it off and lines are compared character by character: item1 → item10 → item2.
Case, kana and kanji
Sorting uses the browser's Japanese collation (Intl.Collator), which orders Latin letters the way an English dictionary does:abc, Abc and ABC sit next to each other (ties that collation cannot separate are broken by code point, so the same input always gives the same output). Hiragana and katakana are interleaved in gojūon order. Kanji carry no reading, so they are not sorted by pronunciation but in JIS level-1 order — roughly the order of a representative on'yomi reading — for example 札幌 → 大阪 → 東京 → 名古屋. For true reading order, put a kana reading at the start of each line first.
Three ways to handle duplicates
Keep the first occurrence is the usual dedupe: one copy stays where it first appeared. Drop every line that repeats keeps only the lines that occur once — stack two lists on top of each other first and this gives you the items that are in only one of them. Keep only the repeated lines, once each is the opposite: on two stacked lists it gives you the items that are in both.
About This Tool
Tidying a list is the same few chores over and over: remove duplicate email addresses, re-sort a column of product codes copied out of a spreadsheet, turn a list of URLs into Markdown bullets, shuffle a draw. A spreadsheet or an editor can do each of them, but trimming, deduplicating and sorting are separate jobs every time. Here you tick the steps you need and they run together, in a fixed order.
Duplicates that "survive" usually differ in ways you cannot see. A trailing space, an ideographic space, Apple versus apple, full-width A versus half-width A — they look the same on screen and are still different lines. Checks reports how many groups of near-duplicates that differ only in surrounding spaces, letter case or width are left. The first two are settings on this page; for width, run the text through the Full-width ⇄ Half-width Converter and come back.
Shuffling is Fisher–Yates, drawing every step from crypto.getRandomValues with rejection sampling. Unlike stretching a single seed into a pseudo-random stream, no possible order is left out however long the list. Pressing "Shuffle again" draws fresh random numbers. Adding seed= to the URL reproduces the same order from the same input, but that reproducible mode builds the order from a 32-bit seed, so with 13 or more lines it cannot reach every possible order — leave seed= off for a draw. The popular shortcut of calling sort() with Math.random() is known to give a biased order.
A trailing newline is kept. If the pasted text ends with a newline, so does the result. As for line endings, the browser's text box turns everything into LF the moment you paste, so the result is LF too. When you need CRLF for Windows, run the result through the Encoding Converter.
Nothing you paste ever leaves the browser — every step runs on your machine, and a list of 100,000 lines is processed in a moment. On this page the site analytics are not given the query part of the URL (anything after ?). Directly callable via URL parameters: /en/lines/?text=b%0Aa%0Ab&dedupe=1&sort=asc / /en/lines/?preset=numbered&sep=paren&pad=1
Other Tools
- 01Batch Image → WebP ConverterWebP Converter
- 02White Background RemoverWhite BG Remover
- 03WCAG Contrast CheckerContrast Checker
- 04Character CounterCharacter Counter
- 05llms.txt Generatorllms.txt Generator
- 06JSON-LD GeneratorJSON-LD Generator
- 07Markdown → PDFMD → PDF
- 08OGP Meta Tag WizardOGP Wizard
- 09Favicon GeneratorFavicon Generator
- 10TikTok PublisherTikTok Publisher
- 11Encoding & Line Ending ConverterEncoding Converter
- 12Batch Image → AVIF ConverterAVIF Converter
- 13Test Data GeneratorTest Data Generator
- 14Marp Markdown → SlidesMarp Slides
- 15Text & Code Diff CheckerDiff Checker
- 16Cron Expression ExplainerCron Explainer
- 17Base64 & Data URI EncoderBase64 & Data URI
- 18URL Parameter Editor & UTM BuilderURL Parameters
- 19HTML Entity Escape & UnescapeHTML Escape
- 20JSON ⇄ YAML ConverterJSON ⇄ YAML
- 21PX ⇄ REM / EM ConverterPX ⇄ REM / EM 単位変換
- 22Color Converter & AlphaColorコード変換&アルファ透過
- 23MD5 / SHA-256 Hash Generatorハッシュ生成
- 24JWT Decoder & Expiry CheckerJWTデコーダー&有効期限チェッカー
- 25User-Agent ParserUser-Agent解析&デバイス判定
- 26UUID & ULID GeneratorUUID (v4) & ULID 一括生成
- 27Aspect Ratio Calculatorアスペクト比計算&サイズ算出
- 28Markdown Table & CSV/TSV ConverterMarkdownテーブル整形&CSV/TSV変換
- 29SQL Query FormatterSQLクエリフォーマッター&整形
- 30QR Code GeneratorQR Code Generator
- 31Regex Tester正規表現テスター
- 32Unix Timestamp ConverterUNIXタイムスタンプ⇄日時変換
- 33New Tab Memo新規タブメモ帳
- 34Image Resizer & Cropper画像リサイズ&クロップ
- 35EXIF Viewer & RemoverEXIF情報の確認&除去
- 36robots.txt Generatorrobots.txt ジェネレーター
- 37Password Generator安全なパスワード生成
- 38Case Converter文字列ケース変換
- 39CSV/TSV ⇄ JSON ConverterCSV/TSV ⇄ JSON 相互変換
- 40PDF Merge, Split & ExtractPDF結合・分割・ページ抽出
- 41Full-width ⇄ Half-width Converter全角⇄半角変換&テキストクリーナー
- 42X (Twitter) Post CounterX(Twitter)投稿の文字ウェイト計算
- 43CSS clamp() Fluid Typography CalculatorCSS clamp() 計算機
- 44CSS Gradient GeneratorCSSグラデーションジェネレーター
- 45Image Colour Palette Extractor画像からカラーパレット抽出
- 46QR Code ReaderQRコード読み取り
- 47SVG Optimizer & Data URISVG最適化&data URI化
- 48Redirect Generatorリダイレクトルール ジェネレーター
- 49IP / CIDR CalculatorIPアドレス・CIDR計算機
- 50ICS Calendar Event GeneratorICS Generator
- 51cubic-bezier Easing Preview & ComparisonEasing Preview
- 52CSS box-shadow Generatorbox-shadow ジェネレーター
- 53Japanese Dummy Text Generator和文ダミーテキスト生成
- 54Social Media Image ResizerSNS画像サイズ一括書き出し
- 55Time Zone Converter & World Clockタイムゾーン変換・世界時計
- 56Date & Business Day Calculator日数・営業日計算
- 57HTML → MarkdownHTML→Markdown変換
- 58HEIC to JPEG/PNG ConverterHEIC Converter
- 59Print Size & DPI Calculator印刷サイズ・DPI計算機
- 60Color Blindness Simulator色覚シミュレーター
- 61SERP Preview & Meta Tag Length CheckerSERPプレビュー&メタタグ文字数チェック
- 62Flexbox & CSS Grid GeneratorFlexbox / CSS Grid ジェネレーター
- 64Screenshot Frame & Background Makerスクリーンショット枠装飾
- 65Japanese Era ⇄ Western Calendar Converter和暦 ⇄ 西暦変換
- 66URL Slug Generator (Japanese → Romaji)URLスラッグ生成(日本語→ローマ字)
- 67htpasswd Generatorhtpasswd ジェネレーター
- 68OGP Image GeneratorOGP画像ジェネレーター