A tiny, dependency-free function that counts Free Fire nickname characters
the way the game actually counts them — not the way string.length does.
Free Fire's nickname field caps at 12 characters. Simple enough — until you try to validate that in code:
"Ghost".length // 5 ✅ correct
"👻Ghost".length // 7 ❌ wrong — emoji is 2 UTF-16 code units
"꧁Ghost꧂".length // 7 ✅ happens to be correct here
"𝓖𝓱𝓸𝓼𝓽".length // 10 ❌ wrong — bold script letters are astral (SMP), 2 units eachJavaScript's .length counts UTF-16 code units, not visible characters.
Anything outside the Basic Multilingual Plane (bold/script/Fraktur styles,
many emoji) reports double. Any nickname validator built on plain .length
will silently reject valid names or accept invalid ones.
Tested in-game across multiple symbol types (『 』, ⚜, ❧) and confirmed: one visible symbol = one character, regardless of which Unicode block it comes from. Free Fire counts by codepoint, not by UTF-16 unit. Full test writeup: https://fontsgeneratorpro.com/free-fire-fonts/
function freeFireCharCount(str) {
return [...str].length; // spreads by codepoint, not UTF-16 unit
}
freeFireCharCount("👻Ghost"); // 6 ✅
freeFireCharCount("𝓖𝓱𝓸𝓼𝓽"); // 5 ✅Python equivalent (Python 3 strings are already codepoint-based, so this is mostly a non-issue there — but here's an explicit version for parity):
def free_fire_char_count(s: str) -> int:
return len(s) # Python 3 str is codepoint-based alreadyThis covers ordinary decorative symbols (brackets, stars, flourishes) — the cases actually tested. Stacked/combining-mark styles (glitch, underline via U+0332/U+0334/U+0336) were not part of the original in-game test and may follow different counting behavior. Don't treat this library as authoritative for those until independently verified.
No install needed — the Free Fire Font Generator has this same counting logic built into a live tool with 200+ styles.
MIT