Skip to main content

LaTeX Fractions — \frac, \dfrac, and \tfrac

Fractions are one of the most common things you will typeset in LaTeX. The \frac command takes two arguments — numerator and denominator — and LaTeX handles the sizing, spacing, and centering for you. This guide covers every fraction variant, when to use each one, and how to avoid the sizing pitfalls that confuse new users.

The Basics

The core command is \frac{numerator}{denominator}. You wrap it in math mode — dollar signs for inline math ($\frac{a}{b}$) or display math for a centered, standalone equation (\[\frac{a}{b}\]).

LaTeX automatically picks a style: in inline math the fraction is compact so it does not stretch the line height, while in display math it renders at full size. When you need to override that behavior, \dfrac(display style) and \tfrac (text style) force the size explicitly. Both come from the amsmath package.

Fractions nest naturally. You can place a fraction in the numerator or denominator of another fraction, and LaTeX shrinks each level so the expression stays readable. For continued fractions where you want every level at full size, use \cfrac instead of \frac.

Inline vs. Display: How \frac Decides

The single most confusing thing about fractions is why the same \frac{1}{2}sometimes renders small and sometimes large. The answer is math style, not the command. Inside $...$LaTeX enters text style: the fraction bar sits at the current line height and the numerator and denominator shrink to about 70% size. This keeps a sentence like "the probability is $\frac{1}{2}$" from blowing up the line spacing.

Inside display math (\[...\], or the \begin{equation} and\begin{align} environments) LaTeX uses display style: the fraction renders at full size with the bar centered and generous spacing. You can think of \frac as "the right size for where I am,"\dfrac as "always full size," and \tfrac as "always compact." When you see an unexpectedly small fraction, you are almost always looking at a \frac that LaTeX decided should be text-style.

Controlling the Size Manually

\dfrac{a}{b} forces the display fraction everywhere — inside inline math, inside exponents, inside matrices. This is what you reach for when a textbook-style fraction is required mid-sentence. Conversely \tfrac{a}{b} forces the compact form even inside display math, which is useful when a fraction appears in a limit, a table cell, or a heading where full display size looks top-heavy.

If you prefer not to change the command, wrap a group in a style declaration:\displaystyle \frac{a}{b} makes every math command after it display-style, and\textstyle \frac{a}{b} forces text style. Because these apply to an entire group, they are handy when a fraction sits inside an \int limit or a \sum where you want the surrounding operator to stay display-sized but the fraction compact.

Fraction Examples

Simple fraction

The standard fraction command. The first argument is the numerator, the second is the denominator.

Display-style fraction

Forces display style, which renders larger and is suitable for standalone equations.

Text-style fraction

Forces text style, which keeps the fraction compact inside running text.

Nested fraction

Fractions can be nested. LaTeX automatically sizes each level.

Continued fraction

Use \cfrac for continued fractions so every level stays full size.

Binomial coefficient

Binomial coefficients are written with \binom, which uses the same two-argument form.

Partial derivative

Fractions are also how partial derivatives are written in calculus.

Fraction with factorials

A classic probability fraction: how many ways to choose k items from n.

Average with a sum

Fractions can contain sums, limits, and any other math markup in either argument.

Fraction with absolute values

Put \left and \right around a fraction to auto-size surrounding delimiters (\left|\frac{a}{b}\right|).

Quick Reference

CommandWhat it doesPackage
\frac{a}{b}Auto-choice of display or text style based on contextcore
\dfrac{a}{b}Always force the larger display styleamsmath
\tfrac{a}{b}Always force the compact text styleamsmath
\cfrac{a}{b}Continued fractions — every level full sizeamsmath
\binom{n}{k}Binomial coefficient, no fraction baramsmath
\frac{a}{b} inside \displaystyleManual display-size override for an inline expressionamsmath

Fractions in Real Mathematics

You will meet fractions in nearly every branch of math. In calculus, derivatives are written as fractions: the chain rule \frac{dy}{dx} = \frac{dy}{du} \cdot \frac{du}{dx}chains three fractions together, and second derivatives use \frac{d^2 y}{dx^2}. In combinatorics the binomial \binom{n}{k} counts combinations, while the probability\frac{n!}{k!(n-k)!} answers "how many ways can this happen."

In statistics an average is a sum over a count: \frac{1}{n}\sum_{i=1}^n x_i. In physics, rates and densities are fractions of differentials, such as velocity\frac{dx}{dt} or the electric field \frac{1}{4\pi\varepsilon_0}\frac{q}{r^2}. Fractions also appear inside matrices: a transition matrix often stores probabilities like\frac{1}{2} in each cell. Whatever the field, the same two-argument\frac command — with \dfrac whenever you need it full-size — is all you need.

Fraction FAQ

What is the difference between \frac, \dfrac, and \tfrac?▼

\frac chooses the style automatically based on context (smaller in inline math, larger in display math). \dfrac always forces the large display style, and \tfrac always forces the compact text style. Use \dfrac inside inline math when you want a full-size fraction, and \tfrac inside display math when you want a compact one.

How do I write a fraction in LaTeX without the amsmath package?▼

\frac is a core LaTeX command and needs no packages. \dfrac, \tfrac, \cfrac, and \binom are provided by amsmath, so add \usepackage{amsmath} to your preamble to use them.

How do I make a fraction bigger or smaller?▼

Use \dfrac for a larger fraction or \tfrac for a smaller one. For manual control, wrap the fraction in \displaystyle or \textstyle, or use \cfrac for continued fractions.

Can I put a fraction in an exponent or subscript?▼

Yes. In an exponent LaTeX automatically uses text style, so $e^{\frac{1}{2}}$ renders a compact fraction. Use \dfrac inside the exponent if you want it larger.

How do I write a binomial coefficient in LaTeX?▼

Use \binom{n}{k} (needs amsmath). The first argument is the top entry, the second is the bottom entry. \binom{n}{k} renders without a fraction bar: the two entries stack directly on each other.

Why is my fraction too small inside \left( \right) or in an exponent?▼

Inside text style the fraction shrinks to fit the line height. Put \dfrac instead of \frac in the numerator, or write \displaystyle before the group, to restore the full display size.

How do I write a negative fraction like a minus sign over b?▼

Put the minus on the numerator: \frac{-a}{b}. If the minus is on the denominator, \frac{a}{-b} also works. Mathematicians conventionally keep the sign in the numerator.

Can I use fractions inside matrices, sums, and limits?▼

Yes. Fractions are ordinary math objects, so they combine freely with \begin{matrix}, \sum, \int, and \left(\right). In display environments like the sum limits they automatically use display-style sizing.