String isWellFormed() and toWellFormed()Baseline · Widely available
The isWellFormed() method of strings returns a boolean indicating if the string contains any Unicode lone surrogates. The toWellFormed() method returns a new string where all lone surrogates are replaced by the Unicode replacement character.
Supported in all major browsers for at least 30 months — safe to use without fallbacks. Baseline since Oct 24, 2023. Widely available since Apr 24, 2026.
Browser support
DesktopChrome
1–110Not supported
111+Supportedsince Mar 7, 2023
Current: 155Edge
12–110Not supported
111+Supportedsince Mar 13, 2023
Current: 154Firefox
1–118Not supported
119+Supportedsince Oct 24, 2023
Current: 157Safari
1–16.3Not supported
16.4+Supportedsince Mar 27, 2023
Current: 27MobileChrome Android
18–110Not supported
111+Supportedsince Mar 7, 2023
Current: 155Firefox Android
4–118Not supported
119+Supportedsince Oct 24, 2023
Current: 157Safari iOS
1–16.3Not supported
16.4+Supportedsince Mar 27, 2023
Current: 27How to use
This feature is Baseline widely available — use it freely, no fallback needed.
Example
Full syntax and examples are on MDN: isWellFormed.
Feature detection
JS · check before using
if ("isWellFormed" in String || ("prototype" in String && "isWellFormed" in String.prototype)) {
// String.isWellFormed is available
}Documentation (MDN)
Specification
Sub-features
Support for each part of the feature (2). The overall table above shows when the whole feature works.
| Sub-feature | Chrome | Edge | Firefox | Safari | Chrome Android | Firefox Android | Safari iOS |
|---|---|---|---|---|---|---|---|
| String.isWellFormed | 111 | 111 | 119 | 16.4 | 111 | 119 | 16.4 |
| String.toWellFormed | 111 | 111 | 119 | 16.4 | 111 | 119 | 16.4 |