Edit 1: For busy people, Google Sheet direct link

Edit 2:  the intitial script was deeply improve by Jean-Francois Picard from lg2.com thank you again for your contribution

Why would you check your <title> Pixel length?

We should check webpages title meta tags because if they are too long, Google will remove the end of the text, like that:


it’s quite annoying really…

A simple way of doing it is to check the number of characters. Moz is explaining it better than I can:

Google typically displays the first 50–60 characters of a title tag. If you keep your titles under 60 characters, our research suggests that you can expect about 90% of your titles to display properly.

This works just fine but if you want to be more precise in your metadata optimization work, you’ ll have to check pixels instead. The reason is all letters do not have the same width. There is even a difference between upper and lower case letters:

How can we simply deal with this problem?

Here comes the Google Sheet! Let me break through the file structure:

    • Column A: ALL the URLs you want to check. In my case, I use the IMPORTXML function to retrieve the latest articles from the BBC website

      //link is an XPath formula to extract URLs from the BBC RSS file. If we were using an XML sitemap file, we should have used ‘//loc’ instead.
    • Column B: crawling URLs using again IMPORTXML function and extracting meta <title>’s
    • Column C: we use LEN function to count the number of characters.
    • Column D: custom function pixelTitle to calculate the corresponding number of pixels.
    • Column E:  custom function pixelTitleTooLong,  using the number of pixels, is the title too long?
    • Column G & H:
      More complexe settings: with G formula you can modify the pixel constant and with column H, you can remove a word et add a words at the end of the title.
      The last one can be useful because sometimes <title> are being rewritten and the brand is added automatically by Google.

So how to use this?

You can make a copy of the Google sheet or if you prefer, you can also copy paste the functions from github inside your Google Script Editor window.

I hope you’ll find it useful!

* *