pipr.tools
Pipes
Clean Email Strip formatting from pasted email for clean plain text Clean AI Output Clean plain text from ChatGPT or AI output Decode & Format JWT Decode a JWT and pretty-print header and payload Word Frequency Count word frequency in text

char-freq Character frequency analysis

# Stats
Input0 chars
Output0 chars

Examples

Analyze character frequencies in a pangram

Usage
"the quick brown fox jumps over the lazy dog" | char-freq

Check character distribution in a marketing headline

Usage
"FLASH SALE: 50% OFF ALL ITEMS THIS WEEKEND ONLY!!!" | char-freq

Study character frequency in a famous literary quote

Usage
"To be, or not to be, that is the question." | char-freq
View source
(input)=>{
                const freq = {};
                for (const c of input)freq[c] = (freq[c] || 0) + 1;
                return Object.entries(freq).sort((a, b)=>b[1] - a[1]).slice(0, 30).map(([c, n])=>{
                    const display = c === "\n" ? "\\n" : c === "\t" ? "\\t" : c === " " ? "␣" : c;
                    return `${display.padEnd(4)} ${String(n).padStart(6)}  ${"█".repeat(Math.min(40, Math.round((n / input.length) * 200)))}`;
                }).join("\n");
            }