Home / How-to guides

How-to

Shopify Size Chart as an HTML Table

Last updated 2026-12-04

A real HTML table beats an image of a table: it is crisp, readable by screen readers, searchable and easy to edit. Here is a table you can paste into a Shopify product description and adapt.

The code is standard HTML. Shopify’s product description editor accepts it in HTML view; your theme’s CSS controls how it looks, so check the result on a phone.

Step by step

  1. In Shopify admin open Products and choose a product.
  2. In the description editor, click the <> (Show HTML) button.
  3. Paste the code below where the chart should go. Edit the numbers.
  4. Click the button again to return to the visual editor, check it, and save.

The code

<div style="overflow-x:auto;">
  <table style="border-collapse:collapse;min-width:360px;width:100%;">
    <caption style="text-align:left;font-weight:bold;padding:8px 0;">
      Women's tops: body measurements in cm (inches)
    </caption>
    <thead>
      <tr>
        <th scope="col" style="text-align:left;border-bottom:1px solid #ccc;padding:6px;">Size</th>
        <th scope="col" style="text-align:left;border-bottom:1px solid #ccc;padding:6px;">Bust</th>
        <th scope="col" style="text-align:left;border-bottom:1px solid #ccc;padding:6px;">Waist</th>
        <th scope="col" style="text-align:left;border-bottom:1px solid #ccc;padding:6px;">Hips</th>
      </tr>
    </thead>
    <tbody>
      <tr><th scope="row" style="text-align:left;padding:6px;">S</th><td style="padding:6px;">84-88 (33-34.5)</td><td style="padding:6px;">66-70 (26-27.5)</td><td style="padding:6px;">90-94 (35.5-37)</td></tr>
      <tr><th scope="row" style="text-align:left;padding:6px;">M</th><td style="padding:6px;">90-94 (35.5-37)</td><td style="padding:6px;">72-76 (28-30)</td><td style="padding:6px;">96-100 (38-39.5)</td></tr>
      <tr><th scope="row" style="text-align:left;padding:6px;">L</th><td style="padding:6px;">96-100 (38-39.5)</td><td style="padding:6px;">78-82 (30.5-32.5)</td><td style="padding:6px;">102-106 (40-42)</td></tr>
    </tbody>
  </table>
</div>
<p>Measure over light clothing. Between sizes? Choose the larger.</p>

These numbers are an example of the format, not a recommendation for your products. Replace them with your own.

Why this markup

Tips

Shopify Size Chart in cm and Inches

If you sell to customers in different countries, a chart in one unit will cost you questions and returns. A toggle lets a shopper pick the unit. This page gives a small version in plain HTML and JavaScript. General guidance, not tested on your theme: use a duplicate theme.

The conversion

1 inch is exactly 2.54 centimetres. To go from inches to cm, multiply by 2.54; from cm to inches, divide by 2.54. Round to one decimal for inches or whole numbers for cm, and keep the rule the same on every chart. Rounding twice (cm to inches to cm) creates drift, so keep one source unit and compute the other.

The code

<div id="sc-wrap">
  <button type="button" data-unit="cm" aria-pressed="true">cm</button>
  <button type="button" data-unit="in" aria-pressed="false">in</button>
  <table>
    <thead><tr><th>Size</th><th>Chest</th><th>Waist</th></tr></thead>
    <tbody>
      <tr><td>S</td><td data-cm="90">90</td><td data-cm="76">76</td></tr>
      <tr><td>M</td><td data-cm="98">98</td><td data-cm="84">84</td></tr>
    </tbody>
  </table>
</div>
<script>
  (function () {
    var wrap = document.getElementById('sc-wrap');
    wrap.addEventListener('click', function (e) {
      var unit = e.target.getAttribute('data-unit');
      if (!unit) return;
      wrap.querySelectorAll('button').forEach(function (b) {
        b.setAttribute('aria-pressed', b === e.target ? 'true' : 'false');
      });
      wrap.querySelectorAll('td[data-cm]').forEach(function (td) {
        var cm = parseFloat(td.getAttribute('data-cm'));
        td.textContent = unit === 'cm' ? cm : (cm / 2.54).toFixed(1);
      });
    });
  })();
</script>

Every number cell stores its source value in data-cm. The script rewrites the text.

Where to put it

Add it as a Custom Liquid block on the product template, or in the body of a size guide page (HTML view). The steps are the same as in the size chart popup and the HTML table pages.

Checks

Limits

It handles one table per page and numbers only. Ranges such as “90-95” need extra code. If you have many charts, an app is less work than maintaining script. See how to add a size chart in Shopify for the other options, or start with a free template.

To keep the source numbers in one place, build them in a spreadsheet first: size chart template in Google Sheets. A ready set of sizes is in the free templates.

See also: Size Chart Design: 12 Rules for a Chart Shoppers Use · How to Add a Size Chart in WooCommerce (Plugin or Not)