iOS Safari Adding Extra Letter Spacing – Why It Happens
In this article
iOS Safari adds extra letter spacing because the browser applies its own text‑rendering heuristics, often triggered by certain CSS properties or font‑fallback behavior.
What You'll Need
- An iPhone or iPad running a recent version of iOS.
- Access to the website or web app you want to test.
- A code editor or the ability to modify the site’s CSS.
- Safari’s Web Inspector (enabled via Settings > Safari > Advanced > Web Inspector).
Step-by-Step
- Open the page that shows the unwanted spacing on your iOS device.
- Enable Web Inspector on the device (Settings > Safari > Advanced > Web Inspector = on). Connect the device to a Mac, open Safari on the Mac, and choose Develop > your device > the page you are testing.
- Inspect the element that appears spaced. Look at the computed styles panel for any of the following properties:
letter-spacingset to a non‑zero value.font-weightorfont-variation-settingsthat force a synthetic bold.font-familythat falls back to a system font not optimized for the chosen weight.text-renderingorfont-smoothing(even though these are not standard on iOS, some libraries add vendor prefixes).
- If you see a
letter-spacingrule, comment it out temporarily in the CSS and reload the page on the device. If the spacing disappears, the rule is the cause. - If no explicit
letter-spacingis present, check thefont-familystack. Safari will substitute the first available font. When the primary font is missing or does not support the requested weight, Safari may render the text using a fallback that includes built‑in kerning adjustments, which can look like extra spacing. - To test the fallback hypothesis, replace the font stack with a known web‑safe font (e.g.,
system-ui) and observe the result. If the spacing normalizes, the original font is the trigger. - Another common trigger is the use of
transform: scale()on text elements. Safari sometimes re‑calculates glyph metrics after a transform, adding subtle spacing. Remove any transform on the affected element and see if the issue resolves. - If the problem persists, add the CSS rule
letter-spacing: normal;explicitly to the element or its parent. This forces Safari to ignore any internal kerning adjustments that it would otherwise apply. - For sites that rely on custom variable fonts, ensure the
font-variation-settingsvalues are within the font’s defined range. Out‑of‑range values can make Safari fall back to a default weight, which often introduces extra spacing. - After you have identified the cause, make the permanent fix in your stylesheet:
- Remove or correct unintended
letter-spacingdeclarations. - Provide a complete fallback stack that includes a font with the same weight and style.
- Avoid applying
transformdirectly to text; instead, wrap the text in a container and transform the container. - Explicitly set
letter-spacing: normal;for elements that inherit from a global rule.
- Remove or correct unintended
- Clear Safari’s cache on the device (Settings > Safari > Clear History and Website Data) and reload the page to verify that the fix works on a fresh load.
Common Mistakes
- Assuming the issue is a bug in Safari rather than a CSS side‑effect. Most spacing anomalies are caused by the page’s own styles.
- Removing
letter-spacingwithout adding a fallbacknormalvalue. Some browsers treat the absence of the property as “inherit”, which can re‑introduce the problem. - Using
font-weight: 600with a font that only defines 400 and 700. Safari synthesizes the missing weight, often by adjusting spacing. - Applying
transform: scale()to inline text instead of a block container, which forces Safari to rasterize the glyphs differently.
Tips
- Test on multiple iOS versions. While the core rendering engine is consistent, minor changes in kerning tables can appear between releases.
- Use the
@font-facedescriptorfont-display: swapto ensure the custom font loads before text is painted, reducing fallback‑induced spacing. - When using variable fonts, set
font-variation-settingswith the exact numeric values Safari expects (e.g.,'wght' 400). - Leverage the CSS property
text-rendering: optimizeLegibilityonly on desktop browsers; iOS Safari ignores it, so it will not cause unintended spacing.
Troubleshooting
If the spacing still looks wrong after following the steps above, try these additional checks:
- Restart Safari. Close all tabs, force‑quit the app, and reopen it. A stale rendering cache can persist across page loads.
- Update iOS. Go to Settings > General > Software Update and install any available update. Apple occasionally refines text‑rendering algorithms.
- Disable experimental features. In Settings > Safari > Advanced > Experimental Features, turn off any toggles you have enabled (e.g., “WebGL 2.0” or “CSS Grid Layout”) to rule out side effects.
- Check for third‑party extensions. Content blockers or style‑injecting extensions can add global
letter-spacingrules. Disable them temporarily. - Inspect the page on a desktop Safari. If the spacing appears only on iOS, the issue is likely tied to the mobile rendering path.
- Use a minimal test case. Create a plain HTML file with a single paragraph, apply the suspect font and weight, and open it on the iOS device. If the spacing is correct, the problem lies elsewhere in your full stylesheet.
- Re‑upload the font files. Corrupted font files can cause Safari to misinterpret kerning tables, leading to extra spacing.
Frequently Asked Questions
Why does Safari sometimes add spacing even when letter-spacing is set to 0?
Safari may still apply its internal kerning tables, especially when the chosen font does not contain the exact weight or style requested. Explicitly setting letter-spacing: normal; can override this behavior.
Is the extra spacing a bug in iOS Safari?
It is not a bug; it is a result of Safari’s text‑rendering heuristics interacting with missing font weights or transforms. Adjusting the CSS removes the symptom.
Can I disable the automatic kerning Safari adds?
Yes. Adding font-kerning: none; or letter-spacing: normal; to the affected element tells Safari not to apply additional kerning.
Does the issue affect other browsers on iOS?
All browsers on iOS use Apple’s WebKit engine, so they exhibit the same behavior. The fix is therefore applicable to Chrome, Edge, and Firefox on iOS as well.
Will using a system font like system-ui prevent the problem?
System fonts are fully supported by iOS and include all necessary kerning data, so they generally do not trigger extra spacing.
What if I need a custom font but cannot guarantee every weight?
Provide explicit fallback weights in your @font-face declarations and avoid requesting weights that are not defined. Alternatively, use font-weight: normal and simulate boldness with font-weight: 700 only if that weight exists.