We and our partners use cookies to Store and/or access information on a device. We and our partners use data for Personalised ads and content, ad and content measurement, audience insights and product development. An example of data being processed may be a unique identifier stored in a cookie. Some of our partners may process your data as a part of their legitimate business interest without asking for consent. To view the purposes they believe they have legitimate interest for, or to object to this data processing use the vendor list link below. The consent submitted will only be used for data processing originating from this website. If you would like to change your settings or withdraw consent at any time, the link to do so is in our privacy policy accessible from our home page.
On small screens, there's not much room so it makes sense to use the smallest font you can without compromising readability. The consensus is mobile font size should be 16px (source, source).
On tablet and desktop, you have more screen real estate so you can afford to make the text size a bit bigger. A good font size for large devices is 18px - 20px.
So what's the best way to set these sizes?
How To Make Font Size Responsive
To make font size responsive in steps, set the base font size at each breakpoint. To create fluid text that smoothly changes size, use the calc() function to calculate a ratio between pixels and viewport widths, this will make the base font size grow at the correct rate relative to the screen width.
Here are some examples:
Stepped Responsive Font Size
To achieve a stepped font size, we simply set the exact base font size that we want for each breakpoint. Here's what that looks like in CSS:
The font size is only optimal at particular breakpoints, in between it might feel too big or too small.
It's verbose. We have to explicitly set the font size for each breakpoint which requires a lot of CSS rules.
Fortunately, there's a simpler way.
Fluid Responsive Font Size
Rather than setting the font size at each breakpoint, we can create a formula to calculate our font size relative to the screen width. We do that with the calc() function.
calc() is supported in all modern browsers so it's safe and reliable to use (source).
Here's how our font size formula looks in CSS:
html {
font-size: calc(15px + 0.390625vw);
}
This formula calculates our font size as 15px plus 0.00390625% of the screen width. These values have been specifically chosen because they result in the perfect font sizes at every breakpoint:
Fluid font sizes per breakpoint
Screen width
Font size
320px (eg: iPhone 4 & 5)
16px
768px (eg: iPad portrait)
18px
1024px (eg: iPad landscape)
19px
1280px
20px
1536px
21px
1920px
23px
2560px
25px
This method is both simple and powerful.
Want an example? This website (that you're reading right now) uses exactly this method of achieving responsive font size. Adjust your browser window to see it in action!
Setting Relative Font Sizes with Responsive Text
When using responsive font sizes use rem units to specify any text that needs to be relative in size to your base font size.