Skip to content
Email Tips

How to Create an HTML Email Signature (With Code)

How to create an HTML email signature step by step: table layout, inline styles, hosted images and links, plus copyable code and how to install it.

Keshur Gojiya

7 min read

How to Create an HTML Email Signature (With Code)

To create an HTML email signature, build it as a small HTML table with inline styles, link every image from an https address with width, height and alt attributes, and keep the code well under Gmail's 10,000-character signature limit. Then open the file in a browser, copy the rendered signature and paste it into your email app's signature settings, because most email apps have no box for raw HTML. The steps and complete, copyable code are below.

Step 1: Plan the content and layout

Decide what goes in before writing any code: name, job title and company, one phone number, email and website, a logo or headshot, and two or three social icons for profiles you keep up to date. Banners, booking links and legal text are optional.

The most dependable layout is an image on the left and the details on the right, which is what the code below uses. Keep the whole signature about 300 to 500 pixels wide, so it fits on a phone screen and in a narrow reading pane.

Step 2: Build the layout with tables, not divs

Classic Outlook for Windows uses Microsoft Word to display email, and caniemail.com lists flexbox and CSS grid as unsupported in every Outlook for Windows version it tested. Tables work everywhere:

  • Use <table> with cellpadding="0" cellspacing="0" border="0" to remove the default spacing.
  • Add role="presentation" so screen readers don't announce it as a data table.
  • Make columns with <td> cells, and nest a second table for the lines of details.
  • Create space with padding on <td> cells rather than margin, which Outlook handles less predictably.

Step 3: Put every style inline

Inline styles are the only kind you can rely on in a signature. A <style> block sits in the file's head, outside the part you copy and paste, and support for style blocks varies between email apps anyway. Put fonts, colours, sizes, padding and borders in a style attribute on each element.

Skip CSS that classic Outlook for Windows ignores. It doesn't support border-radius, so a round headshot should be cropped into a circle in the image file itself.

Step 4: Host images online and size them properly

  • Upload images to your website and link them with full https addresses, such as https://yourcompany.com/signature/logo.png. A local path like images/logo.png breaks as soon as the email leaves your computer.
  • Export at 2x, display at 1x. A headshot shown at 80 × 80 pixels should be a 160 × 160 pixel file, so it stays sharp on high-density screens.
  • Set `width` and `height` attributes to the display size, and repeat them in the inline style. Classic Outlook for Windows ignores CSS width on images, so without the attributes a 2x image shows at double size there.
  • Write alt text for every image. Some email apps hold back images until the reader allows them, and the alt text shows instead.
  • Use PNG or JPG: PNG for logos and social icons, JPG for photos. SVG and WebP aren't displayed by every version of Outlook, and images embedded as base64 make the code enormous.
  • Phone: tel: followed by the full international number without spaces, such as tel:+15555550123, so it dials with one tap.
  • Email: mailto: followed by the address.
  • Website and social profiles: full https addresses.

Give each link its colour and text-decoration:none inline, otherwise many apps show their default blue, underlined link style.

Step 6: Choose a font stack and text sizes

In caniemail.com's tests, custom web fonts don't load in Gmail or in Outlook for Windows. Use a web-safe stack such as font-family:Arial, Helvetica, sans-serif; or font-family:Georgia, 'Times New Roman', serif;. Set sizes in pixels, roughly 15 to 17 px for your name and 12 to 14 px for the rest, with a pixel line-height on every cell so the spacing stays consistent. If your brand font matters, let the logo image carry it.

Step 7: Keep it narrow and light

Gmail allows up to 10,000 characters in a signature, and Google notes that images count toward the limit too, so it's the code behind the signature that counts, not only the words you see. Code exported from word processors can hit the limit even when the signature looks short. The complete example below is about 2,400 characters.

The complete HTML email signature code

This signature follows every step above. Replace the example.com image addresses with your own hosted files, then change the text and links.

<table role="presentation" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse; font-family:Arial, Helvetica, sans-serif;">
  <tr>
    <td valign="top" style="padding:0 16px 0 0;">
      <img src="https://example.com/signature/alex-morgan.jpg" width="80" height="80" alt="Alex Morgan" style="display:block; width:80px; height:80px; border:0;">
    </td>
    <td valign="top" style="padding:0 0 0 16px; border-left:2px solid #0f766e;">
      <table role="presentation" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;">
        <tr>
          <td style="padding:0 0 2px 0; font-size:16px; line-height:20px; font-weight:bold; color:#111111;">Alex Morgan</td>
        </tr>
        <tr>
          <td style="padding:0 0 8px 0; font-size:13px; line-height:18px; color:#555555;">Project Manager, Example &amp; Co.</td>
        </tr>
        <tr>
          <td style="font-size:13px; line-height:20px;">
            <a href="tel:+15555550123" style="color:#333333; text-decoration:none;">+1 555-555-0123</a>
          </td>
        </tr>
        <tr>
          <td style="font-size:13px; line-height:20px;">
            <a href="mailto:alex@example.com" style="color:#333333; text-decoration:none;">alex@example.com</a>
          </td>
        </tr>
        <tr>
          <td style="font-size:13px; line-height:20px;">
            <a href="https://example.com" style="color:#0f766e; text-decoration:none; font-weight:bold;">example.com</a>
          </td>
        </tr>
        <tr>
          <td style="padding:10px 0 0 0;">
            <table role="presentation" cellpadding="0" cellspacing="0" border="0" style="border-collapse:collapse;">
              <tr>
                <td style="padding:0 8px 0 0;">
                  <a href="https://www.linkedin.com/company/example"><img src="https://example.com/signature/linkedin.png" width="20" height="20" alt="LinkedIn" style="display:block; width:20px; height:20px; border:0;"></a>
                </td>
                <td>
                  <a href="https://www.instagram.com/example"><img src="https://example.com/signature/instagram.png" width="20" height="20" alt="Instagram" style="display:block; width:20px; height:20px; border:0;"></a>
                </td>
              </tr>
            </table>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>

What each part does:

  • The outer table has two cells: the photo, and the details with a 2 px brand-coloured left border as the divider.
  • The details sit in a nested table, one row per line, so spacing stays even across email apps.
  • Every image has width, height and alt attributes, plus display:block to remove the small gap some apps add below images. The photo file is 160 × 160 pixels and the icons 40 × 40, all shown at half size.

Step 8: Test before you install

  1. Open the file in a browser and check that every image loads from its https address.
  2. Install it in your own account (step 9), then send test emails to a Gmail address, an Outlook address and, if you can, an iPhone.
  3. Check it on a phone, in dark mode and inside a reply, and tap every link.

When I build HTML email signatures for clients, classic Outlook for Windows is where most problems show up, usually extra spacing or an image at the wrong size.

Step 9: Install it by copying the rendered signature

Most email apps don't accept raw HTML code in their signature settings. Keep only the signature in the file, open it in a browser, press Ctrl+A (Cmd+A on a Mac) to select it, copy, and paste it into:

  • Gmail: Settings > See all settings > General > Signature, then Save Changes at the bottom of the page.
  • New Outlook and Outlook on the web: Settings > Accounts > Signatures.
  • Classic Outlook for Windows: File > Options > Mail > Signatures.
  • Apple Mail on a Mac: Mail > Settings > Signatures, then untick "Always match my default message font".
  • iPhone Mail: Apple says you can only use text in Mail signatures, so a formatted signature there is a workaround, not a supported feature.

Each app has its own quirks, which I cover in separate guides.

FAQ

How do I change my signature in Gmail using HTML code?

Gmail's signature box has no HTML view, so pasted code shows up as plain text tags. Open your HTML file in a browser, copy the rendered signature and paste it into the Signature section of Gmail's settings, with every image on an https address.

Is an HTML email signature generator good enough?

It can be a quick start for a simple signature. Check that the code is table-based with inline styles, that it looks right in Outlook, and where the images are hosted: if they stay on the generator's server, your signature depends on that service.

How do I edit an HTML email signature later?

Edit the HTML file in a code editor, check it in a browser, then copy and paste it into your email app again, because each app stores its own copy. Without touching code, the free signature editor changes an existing signature's text, images and links and copies the result, ready to paste.

Key takeaways

  • Build the signature as a table with inline styles; avoid div layouts, flexbox, grid and style blocks.
  • Host images at https addresses, export them at 2x, and set width, height and alt attributes.
  • Use tel: and mailto: links, a web-safe font stack, and stay well under Gmail's 10,000-character limit.
  • Install it by copying the rendered signature from a browser, not by pasting the code.

Tags

  • Email Signatures
  • HTML Email
  • Tutorials
  • Email Development

About Keshur Gojiya

Web developer and HTML email specialist with 6+ years of experience, building websites and emails for businesses, startups and agencies.

Get to know me
Keep Reading
View All Articles
  • Email Tips

    6 min read

    Email Signature Examples for Business, Teams and Mobile

    Email signature examples by type: simple, professional, small business, team, real estate, banner, booking and mobile, plus what to include and leave out.

    • Email Signatures
    • Design
    Keshur Gojiya
  • Email Tips

    7 min read

    Company-Wide Email Signature: 4 Ways to Set It Up

    How to set up a company-wide email signature: one template per person, Microsoft 365 rules, Google Workspace or a signature service, with honest trade-offs.

    • Email Signatures
    • Branding
    Keshur Gojiya
  • Email Tips

    6 min read

    Email Signature Logo Size: Dimensions That Stay Sharp

    The right email signature logo size, plus headshot, icon and banner dimensions, how to export for retina screens, which formats work and why Outlook resizes.

    • Email Signatures
    • Design
    Keshur Gojiya

Need help with an email or website?

If an email is breaking in Outlook or dark mode, or you have a design that needs building, tell me about it and I’ll reply with next steps.

Email me