diff --git a/crates/nu-cli/src/commands/to_html.rs b/crates/nu-cli/src/commands/to_html.rs
index bd5f3bef25..36867b290b 100644
--- a/crates/nu-cli/src/commands/to_html.rs
+++ b/crates/nu-cli/src/commands/to_html.rs
@@ -39,7 +39,7 @@ fn to_html(args: CommandArgs, registry: &CommandRegistry) -> Result 1 || headers[0] != "") {
+ if !headers.is_empty() && (headers.len() > 1 || headers[0] != "") {
output_string.push_str("");
output_string.push_str("");
@@ -109,7 +109,7 @@ fn to_html(args: CommandArgs, registry: &CommandRegistry) -> Result 1 || headers[0] != "") {
+ if !headers.is_empty() && (headers.len() > 1 || headers[0] != "") {
output_string.push_str("
");
}
output_string.push_str("