What is CJK spacing?
Chinese, Japanese and Korean text is written without spaces between words. When a sentence mixes it with Latin letters, numbers or symbols, such as product names, units or code, many style guides ask for a thin gap between the two scripts so the eye can tell them apart. Compare 使用iPhone拍照 with 使用 iPhone 拍照: the second one is easier to scan, and it is the convention in most Chinese technical writing, in Taiwan style guides and in many Japanese and Korean blogs. The rule was popularised by the open source project pangu.js, which gave the habit its name: "pangu" is the creation myth that separates heaven from earth, and the tool separates Han characters from Latin ones.
This page adds those spaces for you, or removes them when your style guide wants the opposite. It treats ideographs, kana (hiragana and katakana), bopomofo and, as an extra, Korean hangul as the CJK side. On the other side it sees Latin letters, Greek and accented letters, digits and a set of symbols. You can switch each kind on or off: letters, numbers, symbols such as $ % & + - =, operators, half-width punctuation, quotes, brackets and hashtags.
What it leaves alone matters as much. URLs, inline code between backticks and HTML tags are hidden before any rule runs and come back byte for byte, so a link or a command never gets a stray space inside. Full-width punctuation such as , 。 ( ) is never touched, because it already carries its own spacing. Lines that contain no CJK at all are returned exactly as they were. Everything runs in your browser; the text is not uploaded.
How to use it
- Paste your text on the left. The page opens with a sample so you can see the effect right away. You can also open a
.txtor.mdfile. - Choose the operation: add spaces or remove them.
- Turn the groups you care about on or off. If your guide spaces letters but not digits, switch numbers off and the digit contact stays tight.
- Read the status line under the result: it says how many spaces were added or removed.
- Copy the result or download it as a text file. The buttons under the panels send the result to other tools, for example the word counter or the text comparison.
Your choices are remembered on this device; the text you type is not.
Examples
Latin words inside a sentence
當你凝視著bug,bug也凝視著你
當你凝視著 bug,bug 也凝視著你The comma is full-width, so it is left alone. The two Latin words get a space on each side where they touch Han characters.
Numbers, percentages and units
Windows10的使用者有5個,95%是新手
Windows10 的使用者有 5 個,95% 是新手Windows10 keeps its digits attached because no CJK touches them. The digit before 個 and the percent sign before 是 are separated.
Half-width punctuation
你好,世界!今天天氣很好:出門吧
你好, 世界! 今天天氣很好: 出門吧A half-width comma, exclamation mark or colon after CJK gets one space after it, as in Latin text.
URLs and code stay intact
請見https://example.com/a-b?x=1的說明,執行`npm run build`指令
請見 https://example.com/a-b?x=1 的說明,執行 `npm run build` 指令The URL ends where the first CJK character starts, and the code span is never edited inside.
Removing the spaces
日本語と English の混在
日本語とEnglishの混在Switch the operation to remove when your style does not use the gap, for example in some Japanese typesetting. Spaces between two Latin words are never removed.
Common mistakes
- Expecting changes in a text with no CJK. Lines without ideographs, kana or hangul are returned unchanged on purpose, so a mixed document can be processed in one go.
- Running it on text that is already spaced. The tool is idempotent: a second pass changes nothing, and the status says so.
- Spacing text that quotes a URL with CJK punctuation right after it. The URL stops at the first CJK character, so full-width punctuation after it is kept tight, as you would write it.
- Treating Korean like Chinese. Korean already uses spaces between words. Hangul is included because the request came up, but you can switch it off.
- Forgetting the operators. A hyphen between CJK and a word, as in
中文-English, is read as an operator and gets spaces on both sides. Signs that belong to a number or a flag, such as+886,18+or中文 -m, stay attached. Switch operators off if your text uses hyphens as joiners.
Frequently asked questions
Is this the same as pangu.js?
It follows the same rules for the main cases (CJK next to letters, digits, symbols, quotes, brackets and hashtags) and was checked against the examples in its documentation. It does not copy every special case of the latest version, for example product-name suffixes such as Disney+, and it adds hangul and a tighter URL rule. Treat it as a faithful tool for everyday text, not a drop-in replacement for every edge.
Does it change my line breaks or Markdown?
No. Line breaks, indentation and Markdown markers are kept. Backtick code and URLs are protected. If you work on a Markdown file, review headings and tables after the run, since a space is added wherever CJK touches a symbol.
Will it break text that mixes Portuguese or Spanish with CJK?
Accented Latin letters count as letters, so café咖啡 becomes café 咖啡. Nothing is added inside words that have no CJK next to them.
Can I count the result or compare it with the original?
Yes. Use the word counter for the size of the text and the text comparison to see exactly which spaces were added.
How do I remove accents from the Latin part first?
Use remove accents when you need plain ASCII before spacing.