iToolsPro

Line Numbering

Add custom line numbers to every line (e.g. 01. / | 1 |), or strip redundant line numbers copied from code

Input text
Operation
Start Step Width (0=auto)
Result
Tip: runs locally, nothing is uploaded. Stripping removes only the line number and keeps leading indentation, spaces and tabs.
01. · 1: · | 1 | · #1

Line numbers, add or strip in one click

Add line numbers to every line with a custom template, or strip redundant line numbers copied from code. All local, nothing uploaded.

100% local · nothing uploaded

Features

Custom templates
Free-form format via the {n} placeholder - {n}. , | {n} | , #{n} - with start, step and zero-padding.
Smart stripping
Detects common formats like 12. , 12) , | 1 | , #12 , [1] and clears them without touching content.
Bulk processing
Paste multi-line text as a whole, optionally skip blank lines, process every line at once.

Use cases

📝 Technical docs 💻 Code snippets 📜 Log output 📋 Forum code cleanup

文本行号工具指南Line Numbering Guide

了解行号模板、去号规则与常见问题。Line-number templates, stripping rules, and answers to common questions.

功能说明What It Does

文本行号工具支持两种操作:为每行文本添加自定义格式的行号(通过 {n} 占位符控制编号位置与格式),以及识别并去除行首常见的行号(如 12. 、12) 、| 1 | 、#12 等)。

This tool does two things: add custom line numbers to every line (using the {n} placeholder for position and format), and detect & strip common leading line numbers (like 12. , 12) , | 1 | , #12).

全部在浏览器本地完成,数据不会上传。

Everything runs locally in your browser - nothing is uploaded.

行号模板Line-number templates

模板用 {n} 表示当前行号,其余字符原样输出。如 {n}. 生成 1. 、2. ;| {n} | 生成 | 1 |;#{n} 生成 #1。可设置起始编号、步长与零填充位数(如 2 位生成 01、02)。

Use {n} as the line-number placeholder; everything else is literal. E.g. {n}. makes 1. 、2. ;| {n} | makes | 1 |;#{n} makes #1. You can set the start value, step and zero-padding width (e.g. width 2 makes 01, 02).

默认跳过空行,保持文档空行结构不被编号。

Blank lines are skipped by default so the document's empty lines stay unnumbered.

使用步骤How to Use

  1. 选择「添加行号」或「移除行号」模式。Choose "Add line numbers" or "Remove line numbers".
  2. 添加时设置模板、起始号、步长与位数。When adding, set the template, start, step and width.
  3. 粘贴文本,点击「转换」并复制结果。Paste text, click "Convert" and copy the result.

常见问题FAQ

Q1. 移除行号会误删正文吗?Q1. Could stripping remove content?

只会去除行首「数字+分隔符」形态的格式,纯文本与代码不受影响;少数以数字+点开头的句子会被当作行号,请人工确认。Only leading "number + separator" patterns are removed; plain text and code are untouched. Sentences that happen to start with a number and a dot may be treated as line numbers - please double-check.

Q2. 自定义模板怎么写?Q2. How do I write a custom template?

用 {n} 代表行号,其余字符照抄,如 "行{n}: " 生成 "行1: "。模板会在每行开头插入。Use {n} for the number and keep everything else literal, e.g. "Line {n}: " makes "Line 1: ". The template is prepended to each line.

Q3. 空行会编号吗?Q3. Are blank lines numbered?

默认不编号,保持空行空白;取消「空行不加号」后空行也会参与编号。By default blank lines stay blank; uncheck "skip blank lines" to number them too.