Lessons in Email

In depth email design and code articles, tools and email updates.

Created by Jay Oram
🤦 Outlook comment!

MSO Comments

Oh Outlook - you are so special, you have your own specific comments...

Created 28th July 2025
Reading time: 6 minutes

Contents

  1. How do they work?
  2. The anatomy of an mso-comment
  3. Types of comment
  4. Mso-comment configuration tool
  5. T-online.de

What are MSO Comments

The Outlook desktop for Windows application uses Microsoft Word as a rendering engine - which means that we can target it with comments that only work in these specific versions of Outlook.

This guide will give you an overview of how these work as well as some common use cases.

How do they work?

The comments allow you to wrap content that is intended only for Outlook or to hide the content from Outlook.

They behave exactly like normal HTML comments - but have some added extra abilities!

HTML comments

Regular HTML comments place the comment that will be hidden between two arrows, as seen below.


    <!-- A regular HTML comment -->
    

The anatomy of an mso-comment

mso-comment diagram

The mso-comment starts off as a normal HTML comment <!--> but adds some extra information to allow targeting not only Outlook, but using some basic operators, versions of Outlook.

After the first part of the comment, <!-- the information aimed at Outlook sits within square brackets. <!--[...] this can be as simple as <!--[if true]> to target all versions.

Types of comment

There are two different types of mso comments - ones that hide content from Outlook and those that hide Outlook specific content from all other email clients.

Hide from Outlook


    <!--[if !mso]><!-->
    Hide from Outlook
    <!--<![endif]-->
    

Hiding content from Outlook is created by combining the start of a mso-comment, then closing that comment. <!--[if !mso]><!--> Adding in content that is visible to all other email clients, then opening a new comment and closing that with the <!--<![endif]--> mso-comment to hide it from Outlook.

Show to only Outlook


    <!--[if true]>
    Target Outlook Windows only
    <![endif]-->
    

The mso-comment to show only to Outlook hides the content from all email clients, as it is structured like a normal HTML comment, but with the mso specific syntax to give instructions to show on certain Outlook versions.<!--[if true]> <![endif]-->

MSO-Comment syntax

Using the square brackets [...] you can specify which Outlook Windows clients to target. You can create any combination of operators to fit which versions you are trying to target.

Operators

Operator Definition
gt greater than
gte greater than or equal to
lt less than
lte less than or equal to
| or
! not
& and
(mso 9) subexpression

Version Numbers

Version number Outlook version
9 Outlook 2000
10 Outlook 2002
11 Outlook 2003
12 Outlook 2007
14 Outlook 2010
15 Outlook 2013
16 Outlook 2016/2019/2021*
*I know, not useful...

Keywords

Keyword Definition
true Always evaluates to true
false Always evaluates to false
ie Internet Explorer
mso Microsoft Office

MSO-Comment configuration tool

Outlook version

Common use cases

Image swap

Using a CSS media query to swap an image between desktop and mobile. As Outlook doesn't respect the display: none; on the image, we need to hide it with mso-comments.

In the example below, at 600px wide the image with the class of nomob is hidden with display none and the image with the class show is given display block to be shown.

HTML/CSS Editor
Auto-preview enabled
Live Preview

Outlook specific CSS

Sometimes you only want CSS to work in Outlook, ans since the mso-comments are HTML comments, the best way to create CSS just for Outlook is to set any CSS you would like inside a <style> element and wrap that in mso-comments.

Below we are setting a fallback font specifically for Outlook.

HTML/CSS Editor
Auto-preview enabled
Live Preview

Outlook 120dpi xml fix

In every email that could be seen in Outlook Windows Desktop there is a section of xml in the head that resets the pixels per inch of an email to 96 - instead of the zoomed in, 120dpi - and it is a great example of using mso-comments to specifically target Outlook.

HTML/CSS Editor
Auto-preview enabled
Live Preview

Ghost columns and tables

The last example I wanted to share is one that is common in 'Hybrid' coded emails.

This method uses mso-comments to hide the <table><tr><td> elements that are only for Outlook hidden from other email clients.

HTML/CSS Editor
Auto-preview enabled
Live Preview

T-online.de

Why would I mention t-online.de in an article about mso-comments?

Well the problem is t-online ignores the mso-comments that should show code only for Outlook and shows all the code within them. The fix for this as detailed in the specific issue in the email-bugs Github repo is to add a couple of spaces into the comments:


    <!--[if !mso]><! -->
    Hidden on Outlook and not showing on t-online webmail
    <!-- <![endif]-->
    

How common are mso comments?

In 2020 the team at Tilt Studio worked with Really Good Emails to see how common mso comments are in the 4927 emails on the site, below are the top 4:

Conditional Comments Percentage
<!--[if mso]> 44.79399%
<!--[if !mso]> 37.26406%
<!--[if gte mso 9]> 36.00568%
<!--[if (gte mso 9)|(ie)]> 20.11366%

As you can see from the table above, almost 45% of emails included just <!--[if mso]> but if we combine the top 3 comments that would be used to target all mso Outlook clients - it hits 100%!

You can find the full list of mso comments used, plus HTML elements, CSS , at-rules, Doctype and meta tags on https://www.emailplatformstatus.com/

Resources