Enter the viewport width and the desired width of the text as a percentage into the calculator to determine the text size in pixels. This calculator helps in responsive web design to scale text size relative to the viewport size.

Text Size Formula

The following formula is used to calculate the text size.

TS = VW * (DW / 100)

Variables:

  • TS is the text size (pixels)
  • VW is the viewport width (pixels)
  • DW is the desired width of the text (percentage of the viewport width)

To calculate the text size, multiply the viewport width by the desired width percentage and divide by 100.

What is Text Size?

Text size in web design refers to the size of the text as it appears on different devices. It is an important aspect of responsive design, ensuring that text is readable and aesthetically pleasing across various screen sizes. By calculating text size relative to the viewport width, designers can create a harmonious and accessible user experience.

How to Calculate Text Size?

The following steps outline how to calculate the Text Size.


  1. First, determine the viewport width (VW) in pixels.
  2. Next, determine the desired width of the text (DW) as a percentage of the viewport width.
  3. Next, gather the formula from above = TS = VW * (DW / 100).
  4. Finally, calculate the Text Size (TS) in pixels.
  5. After inserting the variables and calculating the result, check your answer with the calculator above.

Example Problem : 

Use the following variables as an example problem to test your knowledge.

viewport width (VW) = 1200 pixels

desired width of the text (DW) = 50%