単語数・文字数カウンター
単語数、文字数、文数、段落数をカウントし、読了時間を推定
0
単語数
0
文字数
0
文字数(スペース除く)
0
文数
0
段落数
—
読了時間
—
スピーチ時間
テキストを入力
単語数カウントとは?
単語数カウンターは、テキストに含まれる単語数・文字数・文数・段落数を表示するツールです。入力をスペースなどの空白文字で分割し、パターンベースのルールで文と段落を検出します。「単語」の定義は言語・文字体系・文脈によって異なります。英語ではスペース区切りのトークンが有効ですが、CJK言語(中国語・日本語・韓国語)では単語間にスペースがなく、ICUのBreakIteratorのような辞書ベースのアルゴリズムが必要です。
文字数カウントには「スペースを含む」と「スペースを除く」の2つの定義があります。合計文字数にはスペース・タブ・改行文字を含むすべてのUnicodeコードポイントが含まれます。スペースを除く文字数はカウント前にすべての空白を除去したもので、Twitter(現X)の投稿文字数制限や、文字単価で請求する翻訳者が使用する指標です。厳格な文字数制限のあるシステムにテキストを貼り付ける際に、この区別は重要です。
読了時間とスピーチ時間の推定は、単語数を平均速度で割ることで算出します。Journal of Memory and Language誌に掲載された研究(Brysbaert, 2019年)では、英語散文の平均黙読速度は1分間238語とされています。プレゼンテーションでの話速は通常1分間130〜160語です。これらの平均値はテキストの難易度・対象読者・言語によって異なりますが、ブログ記事・ドキュメント・スライドの目安として実用的です。
このツールを使う理由
テキストを貼り付けるだけで、アカウント登録やデータ送信なしに、単語数・文字数・文数・段落数をリアルタイムで確認できます。
単語数カウンターの活用例
テキスト指標リファレンス
このツールが報告する各指標には固有の定義があります。下の表に各指標の算出方法を示します。
| 指標 | 算出方法 | 例 |
|---|---|---|
| Words | Sequences separated by whitespace | "hello world" → 2 |
| Characters | All characters including spaces | "hi there" → 8 |
| Characters (no spaces) | Letters, digits, punctuation only | "hi there" → 7 |
| Sentences | Segments ending with . ? or ! | "Hi. Bye!" → 2 |
| Paragraphs | Text blocks separated by blank lines | "A\n\nB" → 2 |
| Reading time | Word count ÷ 238 wpm (silent reading avg) | 1 000 words → ~4.2 min |
| Speaking time | Word count ÷ 150 wpm (presentation pace) | 1 000 words → ~6.7 min |
単語数 vs. 文字数
この2つの指標は異なる問いに答えます。誤った指標を選ぶと、提出の却下やレイアウトの崩れにつながることがあります。
コード例
さまざまな言語で単語数と文字数をプログラムで数える方法です。一貫した比較のため、各例では同じ入力文字列を使用しています。
// Word count — split on whitespace, filter empty strings const text = 'Hello world! How are you?' const words = text.trim().split(/\s+/).filter(Boolean) console.log(words.length) // → 5 // Character count console.log(text.length) // → 27 (with spaces) console.log(text.replace(/\s/g, '').length) // → 22 (without spaces) // Sentence count — split on sentence-ending punctuation const sentences = text.split(/[.!?]+/).filter(s => s.trim().length > 0) console.log(sentences.length) // → 2 // Reading time estimate (238 wpm average) const readingMin = words.length / 238 console.log(Math.ceil(readingMin)) // → 1 min
import re
text = 'Hello world! How are you?'
# Word count
words = text.split()
print(len(words)) # → 5
# Character counts
print(len(text)) # → 27 (with spaces)
print(len(text.replace(' ', ''))) # → 22 (without spaces)
# Sentence count
sentences = [s for s in re.split(r'[.!?]+', text) if s.strip()]
print(len(sentences)) # → 2
# Paragraph count
multiline = """First paragraph.
Second paragraph."""
paragraphs = [p for p in multiline.split('\n\n') if p.strip()]
print(len(paragraphs)) # → 2package main
import (
"fmt"
"strings"
"unicode"
)
func main() {
text := "Hello world! How are you?"
// Word count
words := strings.Fields(text)
fmt.Println(len(words)) // → 5
// Character count (rune-aware for Unicode)
fmt.Println(len([]rune(text))) // → 27
// Characters without spaces
noSpaces := strings.Map(func(r rune) rune {
if unicode.IsSpace(r) {
return -1
}
return r
}, text)
fmt.Println(len([]rune(noSpaces))) // → 22
}# Word count echo "Hello world" | wc -w # → 2 # Character count (bytes — use wc -m for multibyte chars) echo -n "Hello world" | wc -m # → 11 # Line count echo -e "line1\nline2\nline3" | wc -l # → 3 # Count words in a file wc -w < article.txt # → 4230