[{"data":1,"prerenderedAt":732},["ShallowReactive",2],{"guide-character-counting-guide":3},{"id":4,"title":5,"body":6,"date":720,"description":721,"extension":722,"meta":723,"navigation":569,"path":727,"readingTime":728,"seo":729,"stem":730,"__hash__":731},"guides\u002Fguides\u002Fcharacter-counting-guide.md","The Complete Guide to Character Counting for Writers and Developers",{"type":7,"value":8,"toc":702},"minimark",[9,14,18,21,25,28,204,207,211,214,219,222,226,229,297,300,304,333,336,340,343,347,350,353,370,373,382,386,393,413,424,427,431,437,449,452,478,487,491,494,528,535,619,623,654,658,685,689,692,698],[10,11,13],"h2",{"id":12},"why-character-counting-matters","Why Character Counting Matters",[15,16,17],"p",{},"Character limits are everywhere. Social media platforms cap your posts. Search engines truncate your titles and descriptions. Databases enforce field lengths. If you write or code for the web, knowing your character count is not optional — it determines whether your message gets seen or cut off.",[15,19,20],{},"Writers lose engagement when tweets exceed 280 characters. Developers crash forms when input validation ignores length. SEO professionals waste effort when meta descriptions get clipped at 155 characters. Accurate character counting prevents all of these problems.",[10,22,24],{"id":23},"character-limits-across-platforms","Character Limits Across Platforms",[15,26,27],{},"Every platform enforces its own restrictions. Here are the most common ones you will encounter:",[29,30,31,47],"table",{},[32,33,34],"thead",{},[35,36,37,41,44],"tr",{},[38,39,40],"th",{},"Platform",[38,42,43],{},"Field",[38,45,46],{},"Character Limit",[48,49,50,62,72,83,93,104,114,124,135,145,155,164,175,185,194],"tbody",{},[35,51,52,56,59],{},[53,54,55],"td",{},"X (Twitter)",[53,57,58],{},"Tweet",[53,60,61],{},"280",[35,63,64,66,69],{},[53,65,55],{},[53,67,68],{},"Display name",[53,70,71],{},"50",[35,73,74,77,80],{},[53,75,76],{},"Instagram",[53,78,79],{},"Caption",[53,81,82],{},"2,200",[35,84,85,87,90],{},[53,86,76],{},[53,88,89],{},"Bio",[53,91,92],{},"150",[35,94,95,98,101],{},[53,96,97],{},"LinkedIn",[53,99,100],{},"Post",[53,102,103],{},"3,000",[35,105,106,108,111],{},[53,107,97],{},[53,109,110],{},"Headline",[53,112,113],{},"220",[35,115,116,119,121],{},[53,117,118],{},"Facebook",[53,120,100],{},[53,122,123],{},"63,206",[35,125,126,129,132],{},[53,127,128],{},"YouTube",[53,130,131],{},"Title",[53,133,134],{},"100",[35,136,137,139,142],{},[53,138,128],{},[53,140,141],{},"Description",[53,143,144],{},"5,000",[35,146,147,150,152],{},[53,148,149],{},"Google Ads",[53,151,110],{},[53,153,154],{},"30",[35,156,157,159,161],{},[53,158,149],{},[53,160,141],{},[53,162,163],{},"90",[35,165,166,169,172],{},[53,167,168],{},"SMS",[53,170,171],{},"Single segment",[53,173,174],{},"160",[35,176,177,180,183],{},[53,178,179],{},"App Store",[53,181,182],{},"App name",[53,184,154],{},[35,186,187,189,192],{},[53,188,179],{},[53,190,191],{},"Subtitle",[53,193,154],{},[35,195,196,199,202],{},[53,197,198],{},"Google Play",[53,200,201],{},"App title",[53,203,154],{},[15,205,206],{},"These limits change over time. Always verify current limits directly from the platform's documentation before finalizing your content.",[10,208,210],{"id":209},"character-count-vs-byte-count","Character Count vs. Byte Count",[15,212,213],{},"These two measurements seem identical — until you work with non-ASCII text. Understanding the difference prevents subtle bugs and silent truncation.",[215,216,218],"h3",{"id":217},"what-character-count-measures","What Character Count Measures",[15,220,221],{},"Character count counts each visible unit of text. The letter \"A\" is one character. The emoji \"😀\" is one character. The Chinese character \"字\" is one character. Most writing tools and social platforms use character count as their display metric.",[215,223,225],{"id":224},"what-byte-count-measures","What Byte Count Measures",[15,227,228],{},"Byte count measures how much storage the text occupies. The encoding determines the relationship:",[29,230,231,247],{},[32,232,233],{},[35,234,235,238,241,244],{},[38,236,237],{},"Character",[38,239,240],{},"UTF-8 Bytes",[38,242,243],{},"UTF-16 Bytes",[38,245,246],{},"Character Count",[48,248,249,262,273,285],{},[35,250,251,254,257,260],{},[53,252,253],{},"A",[53,255,256],{},"1",[53,258,259],{},"2",[53,261,256],{},[35,263,264,267,269,271],{},[53,265,266],{},"é",[53,268,259],{},[53,270,259],{},[53,272,256],{},[35,274,275,278,281,283],{},[53,276,277],{},"字",[53,279,280],{},"3",[53,282,259],{},[53,284,256],{},[35,286,287,290,293,295],{},[53,288,289],{},"😀",[53,291,292],{},"4",[53,294,292],{},[53,296,256],{},[15,298,299],{},"A tweet with 140 emojis uses 280 characters — but 560 bytes in UTF-8. A database VARCHAR(255) limit of 255 bytes can store 255 ASCII characters, but only 85 Chinese characters. This mismatch causes real failures.",[215,301,303],{"id":302},"when-byte-count-matters","When Byte Count Matters",[305,306,307,315,321,327],"ul",{},[308,309,310,314],"li",{},[311,312,313],"strong",{},"Database columns",": VARCHAR(n) limits refer to characters in MySQL when using utf8mb4, but some databases and ORMs apply byte limits.",[308,316,317,320],{},[311,318,319],{},"API payloads",": REST APIs may enforce byte limits on request bodies.",[308,322,323,326],{},[311,324,325],{},"SMS segments",": Messages exceeding 160 characters (or 70 characters with Unicode) split into segments, increasing costs.",[308,328,329,332],{},[311,330,331],{},"File formats",": Some binary formats reserve fixed byte widths for strings.",[15,334,335],{},"Always clarify whether a limit refers to characters or bytes before you build validation logic.",[10,337,339],{"id":338},"how-to-count-characters-on-different-systems","How to Count Characters on Different Systems",[15,341,342],{},"Your operating system gives you built-in tools for counting characters. No need to install anything for basic counting.",[215,344,346],{"id":345},"windows","Windows",[15,348,349],{},"Word counts characters in its \"Word Count\" dialog (Ctrl+Shift+G). For plain text, open the file in Notepad, select all text (Ctrl+A), and check the status bar — it shows the character position of your cursor, which equals the character count when the cursor is at the end.",[15,351,352],{},"PowerShell offers a quick command:",[354,355,360],"pre",{"className":356,"code":357,"language":358,"meta":359,"style":359},"language-powershell shiki shiki-themes github-light github-dark","(\"Your text here\").Length\n","powershell","",[361,362,363],"code",{"__ignoreMap":359},[364,365,368],"span",{"class":366,"line":367},"line",1,[364,369,357],{},[15,371,372],{},"For files:",[354,374,376],{"className":356,"code":375,"language":358,"meta":359,"style":359},"(Get-Content file.txt -Raw).Length\n",[361,377,378],{"__ignoreMap":359},[364,379,380],{"class":366,"line":367},[364,381,375],{},[215,383,385],{"id":384},"macos","macOS",[15,387,388,389,392],{},"The simplest method is the built-in terminal command ",[361,390,391],{},"wc",":",[354,394,398],{"className":395,"code":396,"language":397,"meta":359,"style":359},"language-bash shiki shiki-themes github-light github-dark","wc -m file.txt\n","bash",[361,399,400],{"__ignoreMap":359},[364,401,402,405,409],{"class":366,"line":367},[364,403,391],{"class":404},"sScJk",[364,406,408],{"class":407},"sj4cs"," -m",[364,410,412],{"class":411},"sZZnC"," file.txt\n",[15,414,415,416,419,420,423],{},"The ",[361,417,418],{},"-m"," flag counts characters (not bytes). Without it, ",[361,421,422],{},"wc -c"," counts bytes — which gives different results for non-ASCII text.",[15,425,426],{},"Preview can also show character count. Open your document, then choose View > Show Word Count, and click the arrow on the counter to switch to character count.",[215,428,430],{"id":429},"linux","Linux",[15,432,433,434,436],{},"Same ",[361,435,391],{}," command works on Linux:",[354,438,439],{"className":395,"code":396,"language":397,"meta":359,"style":359},[361,440,441],{"__ignoreMap":359},[364,442,443,445,447],{"class":366,"line":367},[364,444,391],{"class":404},[364,446,408],{"class":407},[364,448,412],{"class":411},[15,450,451],{},"For inline text in scripts:",[354,453,455],{"className":395,"code":454,"language":397,"meta":359,"style":359},"echo -n \"Your text here\" | wc -m\n",[361,456,457],{"__ignoreMap":359},[364,458,459,462,465,468,472,475],{"class":366,"line":367},[364,460,461],{"class":407},"echo",[364,463,464],{"class":407}," -n",[364,466,467],{"class":411}," \"Your text here\"",[364,469,471],{"class":470},"szBVR"," |",[364,473,474],{"class":404}," wc",[364,476,477],{"class":407}," -m\n",[15,479,415,480,483,484,486],{},[361,481,482],{},"-n"," flag prevents ",[361,485,461],{}," from adding a newline, which would inflate the count by one.",[10,488,490],{"id":489},"common-pitfalls-in-character-counting","Common Pitfalls in Character Counting",[15,492,493],{},"Even experienced developers and writers make these mistakes:",[305,495,496,510,516,522],{},[308,497,498,501,502,505,506,509],{},[311,499,500],{},"Counting bytes instead of characters",": Using ",[361,503,504],{},".length"," on a byte array instead of a decoded string. In JavaScript, ",[361,507,508],{},"\"😀\".length"," returns 2 because JavaScript counts UTF-16 code units, not Unicode characters.",[308,511,512,515],{},[311,513,514],{},"Ignoring invisible characters",": Line breaks, tabs, and zero-width spaces all count. A 280-character tweet with 10 line breaks has room for 270 visible characters plus formatting.",[308,517,518,521],{},[311,519,520],{},"Forgetting BOM",": UTF-8 files with a Byte Order Mark add 3 bytes to the file size. This matters when enforcing strict byte limits.",[308,523,524,527],{},[311,525,526],{},"Emoji variation",": Some emojis render as a single glyph but consist of multiple code points. Skin-tone modifiers and ZWJ sequences (like family emojis) can span 6 or more UTF-16 code units.",[15,529,530,531,534],{},"For JavaScript specifically, use the spread operator or ",[361,532,533],{},"Array.from()"," to count actual Unicode characters:",[354,536,540],{"className":537,"code":538,"language":539,"meta":359,"style":359},"language-javascript shiki shiki-themes github-light github-dark","\u002F\u002F Wrong for emojis and surrogates\n\"😀\".length \u002F\u002F 2\n\n\u002F\u002F Correct\n[...\"😀\"].length \u002F\u002F 1\nArray.from(\"👨‍👩‍👧‍👦\").length \u002F\u002F correct family emoji count\n","javascript",[361,541,542,548,564,571,577,596],{"__ignoreMap":359},[364,543,544],{"class":366,"line":367},[364,545,547],{"class":546},"sJ8bj","\u002F\u002F Wrong for emojis and surrogates\n",[364,549,551,554,558,561],{"class":366,"line":550},2,[364,552,553],{"class":411},"\"😀\"",[364,555,557],{"class":556},"sVt8B",".",[364,559,560],{"class":407},"length",[364,562,563],{"class":546}," \u002F\u002F 2\n",[364,565,567],{"class":366,"line":566},3,[364,568,570],{"emptyLinePlaceholder":569},true,"\n",[364,572,574],{"class":366,"line":573},4,[364,575,576],{"class":546},"\u002F\u002F Correct\n",[364,578,580,583,586,588,591,593],{"class":366,"line":579},5,[364,581,582],{"class":556},"[",[364,584,585],{"class":470},"...",[364,587,553],{"class":411},[364,589,590],{"class":556},"].",[364,592,560],{"class":407},[364,594,595],{"class":546}," \u002F\u002F 1\n",[364,597,599,602,605,608,611,614,616],{"class":366,"line":598},6,[364,600,601],{"class":556},"Array.",[364,603,604],{"class":404},"from",[364,606,607],{"class":556},"(",[364,609,610],{"class":411},"\"👨‍👩‍👧‍👦\"",[364,612,613],{"class":556},").",[364,615,560],{"class":407},[364,617,618],{"class":546}," \u002F\u002F correct family emoji count\n",[10,620,622],{"id":621},"key-takeaways","Key Takeaways",[305,624,625,628,631,642,651],{},[308,626,627],{},"Character limits exist on every major platform — knowing them prevents your content from being silently trimmed.",[308,629,630],{},"Character count and byte count diverge for any text beyond basic ASCII. Always check which metric a platform or system uses.",[308,632,633,634,637,638,641],{},"Built-in OS tools (",[361,635,636],{},"wc -m",", PowerShell ",[361,639,640],{},".Length",") handle character counting without extra software.",[308,643,644,645,647,648,650],{},"JavaScript's ",[361,646,504],{}," property counts UTF-16 code units, not Unicode characters — use ",[361,649,533],{}," or the spread operator for accurate results.",[308,652,653],{},"Invisible characters (line breaks, tabs, zero-width spaces) count toward limits even though readers cannot see them.",[10,655,657],{"id":656},"related-guides","Related Guides",[305,659,660,667,673,679],{},[308,661,662],{},[663,664,666],"a",{"href":665},"\u002Fguides\u002Fword-count-best-practices","Word Count Best Practices",[308,668,669],{},[663,670,672],{"href":671},"\u002Fguides\u002Ftext-length-limits","Text Length Limits",[308,674,675],{},[663,676,678],{"href":677},"\u002Fguides\u002Ftext-analysis-guide","Text Analysis Guide",[308,680,681],{},[663,682,684],{"href":683},"\u002Fguides\u002Fword-count-writing-tips","Word Count Tips for Writing",[10,686,688],{"id":687},"try-it-yourself","Try It Yourself",[15,690,691],{},"Need to verify your character count before posting or committing? Paste your text into our free character counter and get an instant breakdown — characters with and without spaces, byte size, word count, and line count.",[15,693,694],{},[663,695,697],{"href":696},"\u002Ftools\u002Fcharacter-counter","Free Character Counter Tool",[699,700,701],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sj4cs, html code.shiki .sj4cs{--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sJ8bj, html code.shiki .sJ8bj{--shiki-default:#6A737D;--shiki-dark:#6A737D}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}",{"title":359,"searchDepth":550,"depth":550,"links":703},[704,705,706,711,716,717,718,719],{"id":12,"depth":550,"text":13},{"id":23,"depth":550,"text":24},{"id":209,"depth":550,"text":210,"children":707},[708,709,710],{"id":217,"depth":566,"text":218},{"id":224,"depth":566,"text":225},{"id":302,"depth":566,"text":303},{"id":338,"depth":550,"text":339,"children":712},[713,714,715],{"id":345,"depth":566,"text":346},{"id":384,"depth":566,"text":385},{"id":429,"depth":566,"text":430},{"id":489,"depth":550,"text":490},{"id":621,"depth":550,"text":622},{"id":656,"depth":550,"text":657},{"id":687,"depth":550,"text":688},"2026-05-28","Why character limits matter and how to count characters accurately across platforms, tools, and programming languages.","md",{"keywords":724},[725,726],"character-counter","character-counting-guide","\u002Fguides\u002Fcharacter-counting-guide",null,{"title":5,"description":721},"guides\u002Fcharacter-counting-guide","rylDgQa8vsrPGxyLWcwdNfCw8ucjWW1WfR5BcaIvJkI",1780401327871]