diff --git a/rc/filetype/html.kak b/rc/filetype/html.kak
index 4a86e21b..33e65a9b 100644
--- a/rc/filetype/html.kak
+++ b/rc/filetype/html.kak
@@ -80,8 +80,8 @@ define-command -hidden html-indent-on-new-line %{
try %{ execute-keys -draft K }
# filter previous line
try %{ execute-keys -draft k : html-trim-indent }
- # indent after lines ending with opening tag
- try %{ execute-keys -draft k (?!area)(?!base)(?!br)(?!col)(?!command)(?!embed)(?!hr)(?!img)(?!input)(?!keygen)(?!link)(?!menuitem)(?!meta)(?!param)(?!source)(?!track)(?!wbr)(?!/)(?!>)[a-zA-Z0-9_-]+[^>]*?>$ j } }
+ # indent after lines ending with opening tag except when it starts with a closing tag
+ try %{ execute-keys -draft k (?!area)(?!base)(?!br)(?!col)(?!command)(?!embed)(?!hr)(?!img)(?!input)(?!keygen)(?!link)(?!menuitem)(?!meta)(?!param)(?!source)(?!track)(?!wbr)(?!/)(?!>)[a-zA-Z0-9_-]+[^>]*?>$ j^\s*/ } }
}
]
diff --git a/test/indent/html/indent-on-new-line/cmd b/test/indent/html/indent-on-new-line/cmd
new file mode 100644
index 00000000..54aed4f8
--- /dev/null
+++ b/test/indent/html/indent-on-new-line/cmd
@@ -0,0 +1 @@
+i
diff --git a/test/indent/html/indent-on-new-line/in b/test/indent/html/indent-on-new-line/in
new file mode 100644
index 00000000..45bc08e1
--- /dev/null
+++ b/test/indent/html/indent-on-new-line/in
@@ -0,0 +1,3 @@
+
diff --git a/test/indent/html/indent-on-new-line/out b/test/indent/html/indent-on-new-line/out
new file mode 100644
index 00000000..914642e9
--- /dev/null
+++ b/test/indent/html/indent-on-new-line/out
@@ -0,0 +1,4 @@
+
diff --git a/test/indent/html/indent-on-new-line/rc b/test/indent/html/indent-on-new-line/rc
new file mode 100644
index 00000000..ef3301f7
--- /dev/null
+++ b/test/indent/html/indent-on-new-line/rc
@@ -0,0 +1,3 @@
+source "%val{runtime}/colors/default.kak"
+source "%val{runtime}/rc/filetype/html.kak"
+set buffer filetype html