Text Formatter Tool
Batch process line break conversion, whitespace removal, and full-width/half-width conversion.
Text Input
Formatted Result
Formatting Options
What You Can Do
The Text Formatter Tool automatically formats text by converting line breaks, whitespace, and full-width/half-width characters. Perfect for formatting copy-pasted text and data cleaning. All processing happens in your browser, so no data is sent to servers.
- ✅ Line Break Conversion: Convert between CRLF and LF for cross-OS compatibility
- ✅ Whitespace & Blank Line Processing: Remove consecutive spaces, trim whitespace, and delete blank lines
- ✅ Full-width ⇄ Half-width Conversion: Convert alphanumeric characters and katakana, sort lines, and remove duplicates
- ✅ Multiple formatting options: case conversion, whitespace removal, line sorting, and more
- ✅ Remove duplicate lines and blank lines
- ✅ Completely free with no registration required
- ✅ All processing is done in your browser - no data is sent to any server
Use Cases
- Format copy-pasted text - Clean up text extracted from web pages or documents
- Standardize full-width/half-width - Normalize character types for data preprocessing
- Tidy up lists - Sort or reverse lines to make a list easier to read
- Batch convert upper/lowercase - Standardize English text notation
- Remove duplicate lines - Perfect for data cleaning and organization
How to Use
Basic Usage
Enter text and click the formatting option button you want to apply. The formatted text will be displayed in the result area.
Line Break Conversion
- CRLF → LF: Convert Windows format (\r\n) to Unix/Mac format (\n)
- LF → CRLF: Convert Unix/Mac format (\n) to Windows format (\r\n)
Whitespace Processing
- Remove All Spaces: Delete every half-width space, full-width space and tab (line breaks are kept)
- Trim Whitespace: Remove whitespace from the beginning and end of each line
- Normalize Spaces to One: Collapse runs of spaces and tabs within a line into one half-width space (line breaks are kept)
- Remove Blank Lines: Delete all empty lines
Full-width ⇄ Half-width & Use Cases
Supports half-to-full, full-to-half, and katakana conversions. Perfect for cross-OS file conversion, data cleansing, CSV file formatting, and programming text preparation.
Text Formatting Technology & Mechanisms
Full-width/Half-width Character Code Mechanism
Full-width/half-width character conversion uses the relative position of Unicode character code values. There is a fixed offset value (0xFEE0) between half-width alphanumeric characters (ASCII: 0x0021-0x007E) and full-width alphanumeric characters (Unicode: 0xFF01-0xFF5E).
- Half → Full Formula: Full-width code = Half-width code + 0xFEE0
- Full → Half Formula: Half-width code = Full-width code - 0xFEE0
- Katakana Conversion Complexity: Half-width katakana has independent dakuten/handakuten characters, requiring a mapping table to correspond to single full-width katakana characters
Line Break Standards & Compatibility
Different operating systems use different line break representations. This can cause issues during file migration or system integration, making proper conversion important.
- CRLF (Carriage Return + Line Feed): Windows (\r\n). Clearly marks line endings, offering high compatibility with legacy systems
- LF (Line Feed): Unix/Linux/macOS (\n). Simple and efficient, the standard for modern systems
- CR (Carriage Return): Classic Mac OS (\r). Rarely used today
Regular Expression Patterns & Applications
Regular expressions are powerful tools for text formatting. Here are the main patterns used in this tool.
- /\r\n/g: Detects all CRLF. Global flag (g) targets all matches
- /[^\S\r\n]+/g: Detects runs of whitespace other than line breaks (half-width spaces, full-width spaces, tabs)
- /[!-~]/g: Detects half-width alphanumeric and symbols (ASCII 0x21-0x7E range)
- /[!-~]/g: Detects full-width alphanumeric and symbols (Unicode full-width range)
Practical Use Cases for Text Formatting
This tool is useful in many scenarios. Here are specific examples to understand its value.
- Data Import Preprocessing: Before importing to databases or spreadsheets, standardize character codes, spaces, and line breaks to ensure data quality
- Cross-platform Compatibility: When using text files created on Windows on Mac/Linux, convert line breaks to LF
- Web API Response Processing: Normalize text retrieved from external APIs that contains unexpected character codes or spaces
- User Input Cleaning: Remove leading/trailing whitespace and duplicate lines from text submitted via HTML forms
- Log File Analysis: Remove duplicate lines from multi-line logs and extract only necessary data
- Natural Language Processing Preprocessing: Normalize text to a unified format before morphological analysis or text mining
What is the Text Formatter?
Who is this for?
Anyone cleaning up extra spaces and line breaks from copied text, people batch-converting text case, those removing duplicate lines or sorting text, and engineers doing quick data preprocessing.
FAQ
Every button works on the text in the input box once, and the result box is replaced each time (it is not applied on top of the previous result). For example, pressing "Full → Half Width" and then "Sort Lines" gives a result with only the sort applied. To combine options, copy the result, paste it back into the input box, and then press the next button. The buttons never change the text in the input box, so you can try again as often as you like.
It only changes full-width letters, digits and symbols (the range from ! to ~; for example ABC123 becomes ABC123). Full-width spaces, the full-width yen sign (¥) and katakana stay as they are (katakana has its own "Full Kana → Half Kana" button). "Half → Full Width" covers the same range, so half-width spaces and the yen sign (¥) do not change.
Characters with no half-width form (such as ヰ, ヱ, ヵ and ヶ) and hiragana stay as they are. "Full Kana → Half Kana" splits the voicing marks into separate characters (ガ becomes ガ), so the character count goes up, and the reverse conversion brings it down. Japanese punctuation, corner brackets, the middle dot and the long vowel mark (。、「」・ー) are converted as well.
A browser text box receives the line breaks of pasted text as LF, so the text in the input box is always LF and "CRLF → LF" leaves the character count unchanged. If you press "LF → CRLF" and then "Copy", the clipboard gets the text with CRLF line breaks (the result box looks the same, and the character count goes up by the number of line breaks). The app you paste into may convert line breaks to its own format, so if a file must use a specific line break code, also check your editor's save settings.
"Remove All Spaces" deletes every half-width space, full-width space and tab (including the spaces between English words). "Trim Whitespace" removes whitespace only at the start and end of each line. "Normalize Spaces to One" turns each run of whitespace within a line into one half-width space (full-width spaces become half-width). "Remove Blank Lines" deletes lines that are empty or contain only whitespace. All four keep line breaks, so the lines stay where they are.
Sorting follows character code (Unicode) order, not alphabetical-by-meaning, numeric or Japanese syllabary order. Numbers are compared character by character, so "10" comes before "9"; uppercase letters come before lowercase; hiragana comes before katakana; and kanji are not sorted by reading. Duplicate removal only merges lines that are exactly the same and keeps the first one in its original position (lines that differ in letter case or trailing spaces are kept as separate lines).
No. This tool only replaces and reorders characters by fixed rules and does not read the meaning of the text. It does not correct typos, unify wording or politeness levels, summarize or rewrite, so please check the content yourself.
Anything you wish this tool did better? A few words are plenty.