Line Break Converter|换行符转换

换行符转换器 | Line Break Converter (CRLF/LF)

换行符转换器 Line Break Converter

一键将文本换行符在 CRLF(Windows)LF(macOS/Linux) 之间互转,避免跨系统复制粘贴后出现“整段挤成一行 / 显示异常”等问题。
Convert line endings between CRLF and LF to fix formatting issues when copying text across Windows/macOS/Linux.

1. 输入文本 · Input
检测中… Detecting…
CRLF(\r\n):Windows 常用换行。复制到 Linux/macOS 或某些编辑器时,可能出现显示不一致。
LF(\n):Linux/macOS 常用换行。复制到部分 Windows 旧工具时,可能出现“换行不生效”。

提示 · Tip:这不是编码(UTF-8/GBK)转换,而是“行结束符”转换。
This tool converts line endings, not text encoding (UTF-8/GBK).
2. 转换结果 · Output
转换后你可以把结果粘贴到:代码编辑器、论坛帖子、WordPress 文章、Markdown 文档、配置文件等。
After conversion, you can paste it into editors, blog posts, Markdown docs, config files, and more.

复制失败? · Copy failed?
某些浏览器权限限制会阻止自动复制:你仍可手动选中输出框内容后 Ctrl+C(或 ⌘C)。
Some browsers may block clipboard access; you can always select the output and press Ctrl+C (or ⌘C).
行数估算 · Line Count
按当前输出内容统计。Based on current output.
换行类型 · Line Ending
LF / CRLF / Mixed(混合)。
字符数 · Characters
含空格与换行。Includes spaces & newlines.

3. 使用说明 · Notes
  • 你什么时候会需要它? · When do you need this?
    ✅ 从 Windows 复制文本到 Linux/macOS(或反过来)后,出现“换行不见了 / 全部连成一行”。
    ✅ 在不同编辑器之间切换(VS Code / Notepad++ / 记事本 / 在线编辑器),行尾显示异常。
    ✅ 把代码、配置文件、CSV、日志粘贴到论坛/博客时,排版突然乱掉。
    Typical cases: line breaks disappear, everything becomes one long line, or formatting breaks across editors.
  • CRLF vs LF 到底是什么? · What are CRLF and LF?
    CRLF 是两个字符:回车 \r + 换行 \n(Windows 传统格式)。
    LF 是一个字符:换行 \n(Linux/macOS 常用)。
    Some tools strictly expect one style; mismatches can cause display issues.
  • “混合换行”要不要紧? · Is “mixed line endings” a problem?
    混合换行(Mixed)意味着同一段文本里同时存在 CRLF 和 LF。对人眼未必明显,但对工具/脚本可能是坑:
    – Git 提交时出现无意义 diff(看起来改了一堆行)。
    – Shell 脚本在 Linux 上报错(尤其是带 \r 的情况)。
    – CSV / 数据清洗时多出奇怪字符。
    Mixed endings can lead to messy diffs, script errors, and subtle parsing bugs.
  • “保留末尾换行”为什么重要? · Why keep trailing newline?
    很多代码规范要求文件末尾必须有一个换行(POSIX 风格),否则某些拼接/合并工具会把最后一行和下一段粘在一起。
    Many linters and tooling ecosystems prefer a final newline at end-of-file.
  • “清理行尾空白”什么时候开? · When should I trim trailing spaces?
    建议场景:Markdown、脚本、配置文件、粘贴到论坛时(避免行尾空格导致奇怪的排版或渲染差异)。
    不建议场景:你明确需要保留行尾空格(例如某些对齐文本、特定格式协议)。
    Turn it on for cleaner diffs; turn it off if spaces are meaningful.
  • 隐私说明 · Privacy
    本工具纯前端运行,所有文本处理都在你的浏览器本地完成,不会上传到服务器。
    This tool runs fully in your browser; your text is not uploaded anywhere.

说明:本工具用于“文本格式修复与跨平台兼容”,不对内容正确性做保证。若你在处理代码/配置文件,建议转换后用原编辑器再检查一次是否符合项目规范(如 .editorconfig / Git 设置等)。
Note: This is a formatting utility. For code/config files, consider verifying against your project rules (.editorconfig, Git autocrlf settings, CI linters, etc.).