# How fast do browsers correct UTF-16 strings?

DevFeed: [How fast do browsers correct UTF-16 strings?](<https://devfeed.tech/articles/how-fast-do-browsers-correct-utf-16-strings-29392.md>)

Original publisher: [Read original article](<https://lemire.me/blog/2026/02/21/how-fast-do-browsers-correct-utf-16-strings/>)

Author: Daniel Lemire

Published: 2026-02-21T20:07:17Z

Content type: article

Language: en

Sources: [Daniel Lemire](<https://devfeed.tech/sources/daniel-lemire.md>)

Topics: [JavaScript](<https://devfeed.tech/topics/javascript.md>), [Benchmark](<https://devfeed.tech/topics/benchmark.md>), [Chrome](<https://devfeed.tech/topics/chrome.md>), [Chromium](<https://devfeed.tech/topics/chromium.md>), [Edge](<https://devfeed.tech/topics/edge.md>), [Bun](<https://devfeed.tech/topics/bun.md>)

Tags: [benchmark](<https://devfeed.tech/tags/benchmark.md>), [browsers](<https://devfeed.tech/tags/browsers.md>), [bun](<https://devfeed.tech/tags/bun.md>), [chrome](<https://devfeed.tech/tags/chrome.md>), [chromium](<https://devfeed.tech/tags/chromium.md>), [edge](<https://devfeed.tech/tags/edge.md>), [javascript](<https://devfeed.tech/tags/javascript.md>), [programming](<https://devfeed.tech/tags/programming.md>)

## AI overview

This article explains how JavaScript represents UTF-16 strings, how invalid surrogate sequences can be repaired with toWellFormed, and how fast the operation runs. A benchmark across browsers and JavaScript runtimes found varied performance; Chromium-based browsers exceeded ten gigabytes per second in the reported test.

## Source excerpt

JavaScript represents strings using Unicode, like most programming languages today. Each character in a JavaScript string is stored using one or two 16-bit words. The following JavaScript code might surprise some programmers because a single character becomes two 16-bit words. > t="🧰" '🧰' > t.length 2 > t[0] '\ud83e' > t[1] '\uddf0' The convention is ... Continue reading How fast do browsers correct UTF-16 strings?