=PixelWidth(string text, string fontFamily,
 double fontSize, bool bold, bool italics) : int

Results from function inside Excel


Allows you to calculate the width of a string, expressed in pixels. Useful for on-page optimizations.

PixelWidth considers five parameters when calculating the width:

text: The text of the string.

font: The font of the string. For example "Arial" or "Calibri".

fontSize: The size of the font. For example "10" or "16".

bold: Condition to set the string in bold text format. (TRUE or FALSE)

italics: Condition to set the string in italics text format. (TRUE or FALSE)


Write page title tags limited by pixel length for Google SERP:

=PixelWidth("My title","Arial",18)

=IF(PixelWidth("My title","Arial",18)>482,"Too long","Ok")

Get help with this function in the community →