{"id":4536,"date":"2017-07-04T00:00:00","date_gmt":"2017-07-04T00:00:00","guid":{"rendered":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean\/"},"modified":"2025-12-09T15:35:38","modified_gmt":"2025-12-09T20:35:38","slug":"dont-play-hide-and-seek-how-to-keep-your-email-code-clean","status":"publish","type":"post","link":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean","title":{"rendered":"Don&#8217;t Play Hide and Seek: Why You Should Keep Your Email Code Clean"},"content":{"rendered":"<p>Hide and seek may be a fun childhood game, but if you hide content in your code, you may run the risk of hurting your deliverability. And while there are some very important practices you should focus on implementing, like authentication, opt-in, and permission, content and code elements are two of the elements of deliverability you can fully control.<\/p>\n<p>Plus, clean code and content is critical for your user experience too, whether it\u2019s making sure your email renders correctly or that your message gets its point across\u2014so your subscribers click.<\/p>\n<div class=\"cta\">\n<table>\n<tbody>\n<tr>\n<td class=\"block-1\"><img decoding=\"async\" src=\"https:\/\/www.litmus.com\/wp-content\/uploads\/2020\/04\/spam-icon.png\" alt=\"\" \/><\/td>\n<td class=\"block-2\">\n<h2>Make it to the inbox, not the spam folder<\/h2>\n<p>Identify issues that might keep you from the inbox and get actionable help for how to fix them with Litmus Spam Testing.<\/p>\n<p class=\"zero\"><a class=\"btn medium orange button\" rel=\"noopener\" href=\"https:\/\/litmus.com\/spam-filter-tests\" target=\"_blank\" rel=\"noopener noreferrer\">LEARN MORE ABOUT SPAM TESTING \u2192<\/a><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h2>It happened to us!<\/h2>\n<p>For Litmus Live 2014, we went above and beyond by implementing <a rel=\"noopener\" href=\"https:\/\/litmus.com\/blog\/how-to-code-html5-video-background-in-email\">a video background in email. <\/a>It\u2019s our biggest email campaign each year, designed to build a ton of excitement before our event\u2014and drive ticket sales. But one thing we didn\u2019t count on: Our code comments accidentally triggered a few spam filters. The reason?<\/p>\n<p>A comment that read:<\/p>\n<pre><code style=\"background: #444; color: #fff;\">\nYES. HTML5 VIDEO BACKGROUND. \nIN AN EMAIL. BELIEVE IT. \nBRINGING SEXY BACK TO EMAIL LIKE TIMBERLAKE DID TO POP.\n<\/code><\/pre>\n<p>What started as a joke intended for our code-savvy audience of email designers and developers who often peek at our code became a deliverability risk, all because of the word &#8220;sexy&#8221; hidden in our code.<\/p>\n<h2>Keep your code clean<\/h2>\n<p>Keeping your code clean is an important step (though not the only one) to making sure you always reach the inbox. That\u2019s because spammy emails tend to have additional formatting to more easily hide the bad things which make them readable and easy for humans to click on something they shouldn\u2019t.<\/p>\n<p>Poorly written HTML means the spam filter may interpret your message as something it\u2019s not, and may send you to the spam folder just to be safe.<\/p>\n<p>\u201cDirty\u201d code can also dramatically increase the <a rel=\"noopener\" href=\"https:\/\/litmus.com\/blog\/qa-with-mailcharts-on-email-file-size\">size of your email<\/a>. This makes it much longer to load and can impact your subscriber experience, decreasing engagement. Make sure your email is less than 102kb to prevent clipping in Gmail Also at scale, large message sizes may impact processing times at your email service provider (ESP), and in turn, impacting your sending rates.<\/p>\n<p>And clean code isn\u2019t just important for deliverability\u2014it\u2019s important when it comes to making sure your email renders correctly, too.<\/p>\n<p>Double check these things to make sure your code stays clean, decreasing the chance of landing in the spam folder:<\/p>\n<ul>\n<li>Bad tags, too many closing tags, or incorrectly nested tags<\/li>\n<li>Font color too similar to background color, which hides text in your email<\/li>\n<li>Embedded Javascript<\/li>\n<li>Super large font sizes<\/li>\n<li>An invalid font face<\/li>\n<li>Use of an iFrame<\/li>\n<li>HTML comments in your code<\/li>\n<li>Providing attachments<\/li>\n<li>Characters that are not standard ASCII characters<\/li>\n<li>Blank lines in base64 coding<\/li>\n<\/ul>\n<h2>Check your email<\/h2>\n<p>Similarly, make sure you do a thorough spell check of your code and your content to avoid having spam filters think you\u2019re talking about common spam topics like credit or financing, genitalia, or medications.<\/p>\n<p>Another common spammer tactic we see is hiding content by making the text the same color as the background. Double check your <a rel=\"noopener\" href=\"https:\/\/www.litmus.com\/blog\/the-ultimate-guide-to-background-images-in-email\/\">background image<\/a> and be sure to use contrasting colors for your fonts so it doesn\u2019t appear like you\u2019re hiding any code or content from your subscriber.<\/p>\n<p>Double check all your links, too. A typo in your link may flag it as suspicious, or worse, send your subscriber to an actual spam site. Make sure your links are well formed and link to legitimate sites. Only link to domain names, not IP addresses.<\/p>\n<div class=\"cta\">\n<table>\n<tbody>\n<tr>\n<td class=\"block-1\"><img decoding=\"async\" src=\"https:\/\/www.litmus.com\/wp-content\/uploads\/2020\/04\/checklist-icon.png\" alt=\"\" \/><\/td>\n<td class=\"block-2\">\n<h2>Dot your i&#8217;s and cross your t&#8217;s with Litmus<\/h2>\n<p>Double check all of the critical elements that will impact your email&#8217;s performance with Litmus. Preview your email in 70+ email clients, check broken links, and more.<\/p>\n<p class=\"zero\"><a class=\"btn medium orange button\" rel=\"noopener\" href=\"https:\/\/www.litmus.com\/email-testing\" target=\"_blank\" rel=\"noopener noreferrer\">LEARN MORE ABOUT EMAIL TESTING \u2192<\/a><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Avoid using links provided by link-shortening services, such as bit.ly, in email. Some spam filters identify links used by link shortening services as spammy as the true link is being hidden. As an alternative, many ESPs provide a method of link tracking for your emails built-in. We recommend you use this method of tracking the performance of your links rather than link-shortening services.<\/p>\n<h2>Shortcuts to keep your code organized in Litmus Builder<\/h2>\n<p>When you\u2019re building your email in Litmus Builder, there are built-in tools to help you troubleshoot errors and keep your code clean.<\/p>\n<p><strong>Auto-complete <\/strong>allows you to view a list of options for HTML or CSS elements when typing in the code editor. This can be helpful for those times when you forget a specific HTML or CSS element. Just start typing and Builder will show you a list of elements that you can select to pop into your code.<\/p>\n<p>The <strong>Close tags option<\/strong> automatically closes HTML tags while coding. Missing closing HTML tags can cause a variety of issues in email campaigns, so Builder&#8217;s automatic close tags feature is a good way to ensure that you don\u2019t run into any rendering problems due to a rogue open tag.<\/p>\n<p><strong>Grid view<\/strong> toggles a blue grid around all of the individual elements in your email, allowing you to click on those elements and navigate directly to that piece of code in the code editor. Here\u2019s looking at you, Dreamweaver users.<\/p>\n<p><strong>Code analysis<\/strong> shows any unsupported HTML or CSS properties in that specific email client, saving you countless hours of troubleshooting. With Code Analysis activated, you can toggle through dozens of email clients to see support for HTML and CSS in each of those clients.<\/p>\n<div class=\"cta\">\n<table>\n<tbody>\n<tr>\n<td class=\"block-1\"><img decoding=\"async\" src=\"https:\/\/www.litmus.com\/wp-content\/uploads\/2020\/04\/logo.png\" alt=\"\" \/><\/td>\n<td class=\"block-2\">\n<h2>Get to know Litmus Builder<\/h2>\n<p>Quickly build and test on the email clients that matter most to your audience, and utilize reusable HTML and CSS code snippets and pre-tested templates to reduce errors and maintain brand consistency.<\/p>\n<p class=\"zero\"><a class=\"btn medium orange button\" rel=\"noopener\" href=\"https:\/\/litmus.com\/email-builder\" target=\"_blank\" rel=\"noopener noreferrer\">Get started with Builder \u2192<\/a><\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>Looking to learn more about Litmus Builder? <a rel=\"noopener\" href=\"https:\/\/litmus.com\/blog\/litmus-builder-essentials-getting-to-know-email-builder\">Check out our Builder Essentials series<\/a> to learn more coding shortcuts with our email coding editor.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hide and seek may be a fun childhood game, but if you hide content in your code, you may run the risk of hurting your deliverability. Keeping your code clean and organized isn&#8217;t just helpful for landing in the inbox\u2014it&#8217;s important for your subscriber experience, too.<\/p>\n","protected":false},"author":3,"featured_media":4537,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"tags":[1454,499,102,48],"blog_category":[549,53],"class_list":["post-4536","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-clean-code","tag-email-coding","tag-html","tag-spam-filter","blog_category-product","blog_category-tips-resources"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.5 (Yoast SEO v27.7) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Don&#039;t Play Hide and Seek: Why You Should Keep Your Email Code Clean - Litmus<\/title>\n<meta name=\"description\" content=\"Keeping your code clean and organized isn&#039;t just helpful for landing in the inbox\u2014it&#039;s important for your subscriber experience, too.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Don&#039;t Play Hide and Seek: Why You Should Keep Your Email Code Clean\" \/>\n<meta property=\"og:description\" content=\"Keeping your code clean and organized isn&#039;t just helpful for landing in the inbox\u2014it&#039;s important for your subscriber experience, too.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean\" \/>\n<meta property=\"og:site_name\" content=\"Litmus\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/litmusapp\" \/>\n<meta property=\"article:published_time\" content=\"2017-07-04T00:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-09T20:35:38+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.litmus.com\/wp-content\/uploads\/2020\/04\/featured-dmarc-what-it-is-how-it-helps-protect-your-brand-against-email-fraud.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1380\" \/>\n\t<meta property=\"og:image:height\" content=\"724\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@litmusapp\" \/>\n<meta name=\"twitter:site\" content=\"@litmusapp\" \/>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Don't Play Hide and Seek: Why You Should Keep Your Email Code Clean - Litmus","description":"Keeping your code clean and organized isn't just helpful for landing in the inbox\u2014it's important for your subscriber experience, too.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean","og_locale":"en_US","og_type":"article","og_title":"Don't Play Hide and Seek: Why You Should Keep Your Email Code Clean","og_description":"Keeping your code clean and organized isn't just helpful for landing in the inbox\u2014it's important for your subscriber experience, too.","og_url":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean","og_site_name":"Litmus","article_publisher":"https:\/\/www.facebook.com\/litmusapp","article_published_time":"2017-07-04T00:00:00+00:00","article_modified_time":"2025-12-09T20:35:38+00:00","og_image":[{"width":1380,"height":724,"url":"https:\/\/www.litmus.com\/wp-content\/uploads\/2020\/04\/featured-dmarc-what-it-is-how-it-helps-protect-your-brand-against-email-fraud.png","type":"image\/png"}],"twitter_card":"summary_large_image","twitter_creator":"@litmusapp","twitter_site":"@litmusapp","schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean#article","isPartOf":{"@id":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean"},"author":{"name":"","@id":""},"headline":"Don&#8217;t Play Hide and Seek: Why You Should Keep Your Email Code Clean","datePublished":"2017-07-04T00:00:00+00:00","dateModified":"2025-12-09T20:35:38+00:00","mainEntityOfPage":{"@id":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean"},"wordCount":1017,"commentCount":0,"publisher":{"@id":"https:\/\/www.litmus.com\/#organization"},"image":{"@id":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean#primaryimage"},"thumbnailUrl":"https:\/\/www.litmus.com\/wp-content\/uploads\/2020\/04\/featured-dmarc-what-it-is-how-it-helps-protect-your-brand-against-email-fraud.png","keywords":["Clean Code","Email Coding","HTML","Spam Filter"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean","url":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean","name":"Don't Play Hide and Seek: Why You Should Keep Your Email Code Clean - Litmus","isPartOf":{"@id":"https:\/\/www.litmus.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean#primaryimage"},"image":{"@id":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean#primaryimage"},"thumbnailUrl":"https:\/\/www.litmus.com\/wp-content\/uploads\/2020\/04\/featured-dmarc-what-it-is-how-it-helps-protect-your-brand-against-email-fraud.png","datePublished":"2017-07-04T00:00:00+00:00","dateModified":"2025-12-09T20:35:38+00:00","description":"Keeping your code clean and organized isn't just helpful for landing in the inbox\u2014it's important for your subscriber experience, too.","breadcrumb":{"@id":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean#primaryimage","url":"https:\/\/www.litmus.com\/wp-content\/uploads\/2020\/04\/featured-dmarc-what-it-is-how-it-helps-protect-your-brand-against-email-fraud.png","contentUrl":"https:\/\/www.litmus.com\/wp-content\/uploads\/2020\/04\/featured-dmarc-what-it-is-how-it-helps-protect-your-brand-against-email-fraud.png","width":1380,"height":724},{"@type":"BreadcrumbList","@id":"https:\/\/www.litmus.com\/blog\/dont-play-hide-and-seek-how-to-keep-your-email-code-clean#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.litmus.com\/"},{"@type":"ListItem","position":2,"name":"Don&#8217;t Play Hide and Seek: Why You Should Keep Your Email Code Clean"}]},{"@type":"WebSite","@id":"https:\/\/www.litmus.com\/#website","url":"https:\/\/www.litmus.com\/","name":"Litmus","description":"Are you getting the most out of your email marketing?","publisher":{"@id":"https:\/\/www.litmus.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.litmus.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.litmus.com\/#organization","name":"Litmus Software","url":"https:\/\/www.litmus.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.litmus.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.litmus.com\/wp-content\/uploads\/2025\/04\/featured-image.png","contentUrl":"https:\/\/www.litmus.com\/wp-content\/uploads\/2025\/04\/featured-image.png","width":600,"height":314,"caption":"Litmus Software"},"image":{"@id":"https:\/\/www.litmus.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/litmusapp","https:\/\/x.com\/litmusapp"]},{"@type":"Person","@id":""}]}},"acf":[],"_links":{"self":[{"href":"https:\/\/www.litmus.com\/wp-json\/wp\/v2\/posts\/4536","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.litmus.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.litmus.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.litmus.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.litmus.com\/wp-json\/wp\/v2\/comments?post=4536"}],"version-history":[{"count":3,"href":"https:\/\/www.litmus.com\/wp-json\/wp\/v2\/posts\/4536\/revisions"}],"predecessor-version":[{"id":121599,"href":"https:\/\/www.litmus.com\/wp-json\/wp\/v2\/posts\/4536\/revisions\/121599"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.litmus.com\/wp-json\/wp\/v2\/media\/4537"}],"wp:attachment":[{"href":"https:\/\/www.litmus.com\/wp-json\/wp\/v2\/media?parent=4536"}],"wp:term":[{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.litmus.com\/wp-json\/wp\/v2\/tags?post=4536"},{"taxonomy":"blog_category","embeddable":true,"href":"https:\/\/www.litmus.com\/wp-json\/wp\/v2\/blog_category?post=4536"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}