Go to Sign up
Note: Your files never leave your device. We don't upload, transfer, or store your data.
|
|
|
|
|---|---|---|
|
|
|
HTML tables are the standard way to display tabular data on web pages. Writing them by hand for large datasets is tedious and error-prone. The CSV to HTML Table Converter on A.Tools turns any CSV or TSV file into clean, semantic HTML table code — or a DIV-based CSS layout — in seconds, with full control over structure, escaping, and styling.
All processing runs locally in your browser. No data leaves your device.
TABLE mode generates standard HTML using <table>, <tr>, <th>, and <td> tags. This is the correct choice for data tables, reports, and any content that is semantically tabular.
DIV mode generates a <div>-based layout using CSS classes for rows and cells. This is useful when you need a table-like visual layout within a CSS framework that avoids <table> elements (e.g., email templates, certain responsive layouts).
Enable Escape HTML Characters to convert special characters into HTML entities:
| Character | Entity | Why It Matters |
|---|---|---|
& | & | Otherwise starts an HTML entity |
< | < | Otherwise opens an HTML tag |
> | > | Otherwise closes an HTML tag |
" | " | Otherwise breaks attribute values |
' | ' | Otherwise breaks single-quoted attributes |
Always enable this option if your CSV data comes from user input or external sources. It prevents XSS (Cross-Site Scripting) vulnerabilities and rendering errors.
<thead> / <tbody>) Toggle Table Head Structure to generate semantically correct markup:
<table>
<thead>
<tr><th>Name</th><th>Email</th><th>Role</th></tr>
</thead>
<tbody>
<tr><td>Alice</td><td>[email protected]</td><td>Admin</td>
</tr><tr><td>Bob</td><td>[email protected]</td><td>Editor</td></tr>
</tbody>
</table>
Benefits:
Accessibility — Screen readers use <th> and <thead> to navigate table structure.
CSS targeting — Style headers separately from body rows.
Print styling — Repeat <thead> on each printed page.
Semantic HTML — Follows HTML5 specification best practices per MDN Web Docs.
<th>) When Column Header is enabled, the first row of data is rendered with <th> tags instead of <td>. Combined with Table Head Structure, this produces the recommended <thead> + <th> pattern.
Enter text in the Table Caption field to generate a <caption> element. This is the first child of <table> and provides a visible title. Captions are essential for accessibility — screen readers announce the caption before reading table contents.
Table Class — Add one or more CSS classes to the <table> element. Examples: table table-striped table-bordered (Bootstrap), data-table (custom).
Table ID — Set a unique id attribute for JavaScript targeting or CSS specificity: id="sales-data".
Toggle Minify Code to strip whitespace, indentation, and line breaks from the output. Reduces file size for production use.
Edit your data in-browser before converting:
Undo / Redo — Full edit history.
Add / Delete Rows & Columns — Expand or trim the table.
Transpose — Swap rows and columns.
Delete Empty — Remove empty rows and columns.
Deduplicate — Remove duplicate rows.
ABC / abc / Abc — Batch case conversion.
Find & Replace — With regex support.
First Row as Header — Toggle header treatment.
All processing runs client-side via the browser File API. Files are never uploaded, transmitted, or stored. No server-side logging. The HTML escaping feature provides an additional security layer by preventing XSS injection from untrusted CSV data.
Upload a .csv or .tsv file by dragging it onto the upload area, or click to browse. Alternatively, click Enter Data to type or paste data directly.
Use the toolbar to refine your data:
Add, insert, or delete rows and columns.
Transpose the table.
Remove empty rows/columns or duplicate rows.
Change text case.
Find and replace values (supports regex).
Toggle First Row as Header to define column names.
In the Properties panel:
| Option | What It Does |
|---|---|
| Escape HTML Characters | Convert & < > " ' to HTML entities |
| DIV Table | Use <div> + CSS instead of <table> tags |
| Minify Code | Strip whitespace and line breaks |
| Table Head Structure | Generate <thead> and <tbody> blocks |
| Column Header | Render first row with <th> tags |
| Table Caption | Add a <caption> element |
| Table Class | Set CSS class(es) on the table |
| Table ID | Set an id attribute on the table |
Click Convert. The HTML code appears in the Output Data panel.
Click Copy to Clipboard to paste the code into your HTML file, template, or CMS. Click Download File (Premium) to save as .html.
Input CSV:
Product,Price,Stock,Category
Widget A,$12.99,145,Hardware
Widget B,$8.50,0,Hardware
Gadget X,$45.00,23,Electronics
Gadget Y,$99.99,7,Electronics
Settings: Escape HTML: On, Table Head: On, Column Header: On, Table Class: table table-striped table-bordered, Table Caption: Product Catalog
Output:
<table class="table table-striped table-bordered">
<caption>Product Catalog</caption>
<thead>
<tr><th>Product</th><th>Price</th><th>Stock</th><th>Category</th></tr>
</thead>
<tbody>
<tr><td>Widget A</td><td>$12.99</td><td>145</td><td>Hardware</td></tr>
<tr><td>Widget B</td><td>$8.50</td><td>0</td><td>Hardware</td></tr>
<tr><td>Gadget X</td><td>$45.00</td><td>23</td><td>Electronics</td></tr>
<tr><td>Gadget Y</td><td>$99.99</td><td>7</td><td>Electronics</td></tr>
</tbody>
</table>
Input CSV:
Name,Feedback
Alice,"Great product & fast shipping"
Bob,"Price < $20 = great value"
Carol,"She said \"awesome\""
Settings: Escape HTML: On
Output (relevant cells):
<td>Great product & fast shipping</td>
<td>Price < $20 = great value</td>
<td>She said "awesome"</td>
Without escaping, the < in Bob's feedback would break the HTML, and the & in Alice's would start an invalid entity.
Input CSV:
Metric,Q1,Q2,Q3,Q4
Revenue,$1.2M,$1.5M,$1.8M,$2.1M
Users,12K,15K,18K,22K
Settings: DIV Table: On, Table Class: grid-table, Table ID: quarterly-metrics
Output:
<div class="grid-table" id="quarterly-metrics">
<div class="row header">
<div class="cell">Metric</div>
<div class="cell">Q1</div>
<div class="cell">Q2</div>
<div class="cell">Q3</div>
<div class="cell">Q4</div>
</div>
<div class="row">
<div class="cell">Revenue</div>
<div class="cell">$1.2M</div>
<div class="cell">$1.5M</div>
<div class="cell">$1.8M</div>
<div class="cell">$2.1M</div>
</div>
<div class="row">
<div class="cell">Users</div>
<div class="cell">12K</div>
<div class="cell">15K</div>
<div class="cell">18K</div>
<div class="cell">22K</div>
</div></div>
A well-structured HTML table uses four elements:
<table> — The container.
<caption> — A visible title (accessibility requirement per WCAG 2.1).
<thead> — Column headers wrapped in <th> cells.
<tbody> — Data rows wrapped in <td> cells.
This structure is recommended by the HTML specification and MDN Web Docs.
If your CSV contains user-generated content (comments, names, descriptions), always enable Escape HTML Characters. A cell containing <script>alert('xss')</script> would execute in the browser if not escaped. The tool converts it to <script>alert('xss')</script>, which renders safely as visible text.
Use DIV mode when:
Rendering HTML emails (many email clients strip <table> or have limited CSS support).
Building responsive layouts where CSS Grid/Flexbox provides better control.
Embedding in frameworks that restrict <table> usage.
Use TABLE mode for everything else — it is semantically correct for tabular data and provides better accessibility.
For WCAG 2.1 compliance, an HTML table should include:
<caption> — Describes the table's purpose.
<th> with scope="col" — Identifies column headers.
<thead> / <tbody> — Separates headers from data.
Avoid merged cells (colspan/rowspan) when possible.
This tool generates <caption>, <thead>, <tbody>, and <th> automatically when the corresponding options are enabled.
No. All file processing happens entirely in your browser using JavaScript. Your CSV data is never uploaded, transferred, or stored on any server.
TABLE mode uses standard <table>, <tr>, <td> HTML tags. DIV mode uses <div> elements with CSS classes. TABLE mode is semantically correct for data tables and provides better accessibility. DIV mode is useful for email templates and certain CSS frameworks.
HTML escaping converts &, <, >, ", and ' into their entity equivalents (&, <, etc.). This prevents XSS attacks and rendering errors when your CSV data contains characters that have special meaning in HTML. Always enable it for user-generated content.
<thead>/<tbody> structure? <thead> wraps the header row in <th> cells, and <tbody> wraps the data rows in <td> cells. This is the recommended HTML5 structure for tables, providing better accessibility, print support, and CSS targeting.
Yes. Enter table table-striped table-bordered (or any other classes) in the Table Class field. The generated <table> tag will include class="table table-striped table-bordered".
Minify removes all whitespace, indentation, and line breaks from the HTML output, producing a single line of code. This reduces file size for production use.
The tool accepts .csv (comma-separated values) and .tsv (tab-separated values) files. You can also enter data manually through the built-in table editor.
Processing is entirely client-side. The practical limit depends on your browser and device memory. Files up to several megabytes (tens of thousands of rows) typically work without issue.