<mfrac>

Baseline Widely available *

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

* Some parts of this feature may have varying levels of support.

The <mfrac> MathML element is used to display fractions. It can also be used to mark up fraction-like objects such as binomial coefficients and Legendre symbols.

Syntax

html
<mfrac>numerator denominator</mfrac>

Attributes

This element's attributes include the global MathML attributes as well as the following attributes:

denomalign

The alignment of the denominator under the fraction. Possible values are: left, center (default), and right.

linethickness

A <length-percentage> indicating the thickness of the horizontal fraction line.

numalign

The alignment of the numerator over the fraction. Possible values are: left, center (default), and right.

Note: For the linethickness attribute, some browsers may also accept the deprecated values medium, thin and thick (whose exact interpretation is left to implementers) or legacy MathML lengths.

Examples

Simple fraction

The following MathML code should render as a fraction with numerator "a + 2" and denominator "3 − b":

html
<math display="block">
  <mfrac>
    <mrow>
      <mi>a</mi>
      <mo>+</mo>
      <mn>2</mn>
    </mrow>
    <mrow>
      <mn>3</mn>
      <mo>−</mo>
      <mi>b</mi>
    </mrow>
  </mfrac>
</math>

Fraction without bar

The following MathML code should render as a binomial coefficient:

html
<math display="block">
  <mrow>
    <mo>(</mo>
    <mfrac linethickness="0">
      <mi>n</mi>
      <mi>k</mi>
    </mfrac>
    <mo>)</mo>
  </mrow>
</math>

Technical summary

Implicit ARIA role None

Specifications

Specification
MathML Core
# fractions-mfrac

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
mfrac
Chrome – Full support
Chrome 109 (Release date: 2023-01-10)
footnote Full support
Edge – Full support
Edge 109 (Release date: 2023-01-12)
footnote Full support
Firefox – Full support
Firefox 1 (Release date: 2004-11-09)
footnote Full support
Opera – Full support
Opera 95 (Release date: 2023-02-01)
footnote Full support
Safari – Full support
Safari 5.1 (Release date: 2011-07-20)
footnote Full support
Chrome Android – Full support
Chrome Android 109 (Release date: 2023-01-10)
footnote Full support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – Full support
Opera Android 74 (Release date: 2023-03-13)
footnote Full support
Safari on iOS – Full support
Safari on iOS 5 (Release date: 2011-10-12)
footnote Full support
Samsung Internet – Full support
Samsung Internet 21 (Release date: 2023-05-19)
footnote Full support
WebView Android – Full support
WebView Android 109 (Release date: 2023-01-10)
footnote Full support
WebView on iOS – Full support
WebView on iOS 5 (Release date: 2011-10-12)
footnote Full support
denomalign
Deprecated Non-standard
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – No support
Firefox 1 – 70 (Release date: 2004-11-09)
footnote Removed in 71 and later
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 5.1 (Release date: 2011-07-20)
footnote Full support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android 4 – 68 (Release date: 2011-03-29)
footnote Removed in 79 and later
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 5 (Release date: 2011-10-12)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 5 (Release date: 2011-10-12)
footnote Full support
linethickness
Chrome – Full support
Chrome 109 (Release date: 2023-01-10)
footnote Full support
Edge – Full support
Edge 109 (Release date: 2023-01-12)
footnote Full support
Firefox – Full support
Firefox 1 (Release date: 2004-11-09)
footnote Full support
Opera – Full support
Opera 95 (Release date: 2023-02-01)
footnote Full support
Safari – Partial support
Safari 5.1 – 8 (Release date: 2011-07-20)
footnote Partial support
footnote Only 0, thin, medium, and thick are supported.
Safari – Full support
Safari 9 (Release date: 2015-09-30)
footnote Full support
Chrome Android – Full support
Chrome Android 109 (Release date: 2023-01-10)
footnote Full support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – Full support
Opera Android 74 (Release date: 2023-03-13)
footnote Full support
Safari on iOS – Partial support
Safari on iOS 5 – 8 (Release date: 2011-10-12)
footnote Partial support
footnote Only 0, thin, medium, and thick are supported.
Safari on iOS – Full support
Safari on iOS 9 (Release date: 2015-09-16)
footnote Full support
Samsung Internet – Full support
Samsung Internet 21 (Release date: 2023-05-19)
footnote Full support
WebView Android – Full support
WebView Android 109 (Release date: 2023-01-10)
footnote Full support
WebView on iOS – Partial support
WebView on iOS 5 – 8 (Release date: 2011-10-12)
footnote Partial support
footnote Only 0, thin, medium, and thick are supported.
WebView on iOS – Full support
WebView on iOS 9 (Release date: 2015-09-16)
footnote Full support
Named spaces (e.g. thinmathspace to mean 3/18em)
Deprecated Non-standard
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – Full support
Firefox 1 (Release date: 2004-11-09)
footnote Full support
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote Full support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – Full support
Firefox for Android 4 (Release date: 2011-03-29)
footnote Full support
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
footnote Full support
Nonzero unitless values (e.g. 5 to mean 500% the default thickness)
Deprecated Non-standard
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – No support
Firefox 1 – 69 (Release date: 2004-11-09)
footnote Removed in 70 and later
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 10 (Release date: 2016-09-20)
footnote Full support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android 4 – 68 (Release date: 2011-03-29)
footnote Removed in 79 and later
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 10 (Release date: 2016-09-13)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 10 (Release date: 2016-09-13)
footnote Full support
thin, medium, thick values
Deprecated Non-standard
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – No support
Firefox 1 – 82 (Release date: 2004-11-09)
footnote Removed in 83 and later
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 5.1 (Release date: 2011-07-20)
footnote Full support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android 4 – 82 (Release date: 2011-03-29)
footnote Removed in 83 and later
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 5 (Release date: 2011-10-12)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 5 (Release date: 2011-10-12)
footnote Full support
numalign
Deprecated Non-standard
Chrome – No support
Chrome
footnote No support
Edge – No support
Edge
footnote No support
Firefox – No support
Firefox 1 – 70 (Release date: 2004-11-09)
footnote Removed in 71 and later
Opera – No support
Opera
footnote No support
Safari – Full support
Safari 5.1 (Release date: 2011-07-20)
footnote Full support
Chrome Android – No support
Chrome Android
footnote No support
Firefox for Android – No support
Firefox for Android 4 – 68 (Release date: 2011-03-29)
footnote Removed in 79 and later
Opera Android – No support
Opera Android
footnote No support
Safari on iOS – Full support
Safari on iOS 5 (Release date: 2011-10-12)
footnote Full support
Samsung Internet – No support
Samsung Internet
footnote No support
WebView Android – No support
WebView Android
footnote No support
WebView on iOS – Full support
WebView on iOS 5 (Release date: 2011-10-12)
footnote Full support

Legend

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

Full support
Full support
Partial support
Partial support
No support
No support
Non-standard. Check cross-browser support before using.
Deprecated. Not for use in new websites.
Has more compatibility info.