HTML tfoot

Sriparno08's avatar
Published Jul 31, 2021Updated Sep 27, 2025
Contribute to Docs

The HTML <tfoot> element is used to define a footer section for a table. It typically contains summary information, totals, or notes related to the data presented in the table body.

  • Front-end engineers work closely with designers to make websites beautiful, functional, and fast.
    • Includes 34 Courses
    • With Professional Certification
    • Beginner Friendly.
      115 hours
  • Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.
    • Beginner Friendly.
      7 hours

HTML <tfoot> Syntax

<table>
  <thead>
    <!-- Header rows -->
  </thead>
  <tbody>
    <!-- Main data rows -->
  </tbody>
  <tfoot>
    <!-- Footer rows -->
  </tfoot>
</table>

Note: The HTML <tfoot> element is usually used along with <tbody> and <thead>, which provides useful semantic information.

This example uses HTML <tfoot> to define a simple footer for a table:

<table border="1">
<thead>
<tr>
<th>Items</th>
<th>Cost</th>
</tr>
</thead>
<tbody>
<tr>
<td>Model 3</td>
<td>50,000</td>
</tr>
<tr>
<td>1 giant rubber debugging duck</td>
<td>10,000</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>Total</td>
<td>60,000</td>
</tr>
</tfoot>
</table>

Here is the output:

Simple footer for a table, created using HTML <tfoot>

This example uses HTML <tfoot> to create a footer for a table that contains a note about the table’s data:

<table border="1">
<thead>
<tr>
<th>Month</th>
<th>Sales</th>
</tr>
</thead>
<tbody>
<tr>
<td>January</td>
<td>$500</td>
</tr>
<tr>
<td>February</td>
<td>$450</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">* Data is provisional and may change.</td>
</tr>
</tfoot>
</table>

Here is the output:

Footer for a table containing a note about the table's data, created using HTML <tfoot>

Example 3: Complex Table with Multiple Columns

This example uses HTML <tfoot> to create a footer for a table that summarizes the marks in it with a total score:

<table border="1">
<thead>
<tr>
<th>Subject</th>
<th>Marks</th>
<th>Grade</th>
</tr>
</thead>
<tbody>
<tr>
<td>Math</td>
<td>90</td>
<td>A</td>
</tr>
<tr>
<td>Science</td>
<td>85</td>
<td>B</td>
</tr>
</tbody>
<tfoot>
<tr>
<td>Total</td>
<td>175</td>
<td>-</td>
</tr>
</tfoot>
</table>

Here is the output:

Footer for a table summarizing the marks in it with a total score, created using HTML <tfoot>

Frequently Asked Questions

1. What is <tfoot> in HTML?

The HTML <tfoot> element defines a footer section for a table. It is mainly used to display summary information, totals, or notes that apply to the table data.

2. What are the <thead> and <tfoot> tags used for in HTML?

  • <thead>: Defines the header section of a table, usually containing column titles.
  • <tfoot>: Defines the footer section, often used for summaries or totals.

3. Is <tfoot> required in every HTML table?

No, it’s optional to use <tfoot> in an HTML table. You only need it if you want to display footer information such as totals or notes.

All contributors

Contribute to Docs

Learn HTML on Codecademy

  • Front-end engineers work closely with designers to make websites beautiful, functional, and fast.
    • Includes 34 Courses
    • With Professional Certification
    • Beginner Friendly.
      115 hours
  • Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.
    • Beginner Friendly.
      7 hours