text-rendering

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since January 2020.

The text-rendering attribute provides hints to the renderer about what tradeoffs to make when rendering text.

Note: As a presentation attribute, text-rendering also has a CSS property counterpart: text-rendering. When both are specified, the CSS property takes priority.

You can use this attribute with the following SVG elements:

Example

html
<svg viewBox="0 0 140 40" xmlns="http://www.w3.org/2000/svg">
  <text y="15" text-rendering="geometricPrecision">Geometric precision</text>
  <text y="35" text-rendering="optimizeLegibility">Optimized legibility</text>
</svg>

Usage notes

Value auto | optimizeSpeed | optimizeLegibility | geometricPrecision
Default value auto
Animatable discrete
auto

This value indicates that the user agent shall make appropriate tradeoffs to balance speed, legibility and geometric precision, but with legibility given more importance than speed and geometric precision.

optimizeSpeed

This value indicates that the user agent shall emphasize rendering speed over legibility and geometric precision. This option will sometimes cause some user agents to turn off text anti-aliasing.

optimizeLegibility

This value indicates that the user agent shall emphasize legibility over rendering speed and geometric precision. The user agent will often choose whether to apply anti-aliasing techniques, built-in font hinting or both to produce the most legible text.

geometricPrecision

This value indicates that the user agent shall emphasize geometric precision over legibility and rendering speed. This option will usually cause the user agent to suspend the use of hinting so that glyph outlines are drawn with comparable geometric precision to the rendering of path data.

Specifications

Specification
Scalable Vector Graphics (SVG) 2
# TextRenderingProperty

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
text-rendering
Chrome – Full support
Chrome 4 (Release date: 2010-01-25)
footnote
footnote This property is only supported on Windows and Linux.
footnote Initial versions had bugs on Windows and Linux that broke font substitution, small-caps, letter-spacing or caused text to overlap. See bug 40156511, bug 40430936, bug 40444347, bug 40286561.
Edge – Full support
Edge 79 (Release date: 2020-01-15)
footnote
footnote This property is only supported on Windows and Linux.
footnote Initial versions had bugs on Windows and Linux that broke font substitution, small-caps, letter-spacing or caused text to overlap. See bug 40156511, bug 40430936, bug 40444347, bug 40286561.
Firefox – Full support
Firefox 1 (Release date: 2004-11-09)
footnote
footnote This property is only supported on Windows and Linux.
footnote The optimizeSpeed option has no effect on Firefox 4 because the standard code for text rendering is already fast and there is not a faster code path at this time. See bug 595688 for details.
Opera – Full support
Opera 15 (Release date: 2013-07-02)
footnote Full support
Safari – Full support
Safari 5 (Release date: 2010-06-07)
footnote Full support
Chrome Android – Full support
Chrome Android 18 (Release date: 2012-06-27)
footnote
footnote This property is only supported on Windows and Linux.
footnote Initial versions had bugs on Windows and Linux that broke font substitution, small-caps, letter-spacing or caused text to overlap. See bug 40156511, bug 40430936, bug 40444347, bug 40286561.
Firefox for Android – Full support
Firefox for Android 46 (Release date: 2016-04-26)
footnote Full support
Opera Android – Full support
Opera Android 14 (Release date: 2013-05-21)
footnote Full support
Safari on iOS – Full support
Safari on iOS 4.2 (Release date: 2010-11-22)
footnote Full support
Samsung Internet – Full support
Samsung Internet 1 (Release date: 2013-04-27)
footnote
footnote This property is only supported on Windows and Linux. Samsung Internet is not on Windows or Linux.
WebView Android – Full support
WebView Android 3 (Release date: 2011-02-22)
footnote
footnote From version 3 to 4.3, there is a serious bug where text-rendering: optimizeLegibility causes custom web fonts to not render. This was fixed in version 4.4.
WebView on iOS – Full support
WebView on iOS 4.2 (Release date: 2010-11-22)
footnote Full support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
See implementation notes.

See also