diff --git a/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp b/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp
index 67568045b6..4d860159b7 100644
--- a/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp
+++ b/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp
@@ -311,7 +311,8 @@ Optional run_prescan_byte_stream_algorithm(DOM::Document& document,
if (!need_pragma.has_value() || (need_pragma.value() && !got_pragma) || !charset.has_value())
continue;
- if (charset.value() == "UTF-16BE/LE")
+ // https://encoding.spec.whatwg.org/#common-infrastructure-for-utf-16be-and-utf-16le
+ if (charset.value() == "UTF-16BE" || charset.value() == "UTF-16LE")
return "UTF-8";
else if (charset.value() == "x-user-defined")
return "windows-1252";
diff --git a/Tests/LibWeb/Text/expected/document-computed-mimetype.txt b/Tests/LibWeb/Text/expected/document-computed-mimetype.txt
index e186e01bb9..c3676e9ea0 100644
--- a/Tests/LibWeb/Text/expected/document-computed-mimetype.txt
+++ b/Tests/LibWeb/Text/expected/document-computed-mimetype.txt
@@ -1 +1,4 @@
-PASS: UTF-8
+Encoding: utf-16be mapped to characterSet: UTF-8
+Encoding: utf-16le mapped to characterSet: UTF-8
+Encoding: utf-8 mapped to characterSet: UTF-8
+Encoding: x-user-defined mapped to characterSet: windows-1252
diff --git a/Tests/LibWeb/Text/input/document-computed-mimetype.html b/Tests/LibWeb/Text/input/document-computed-mimetype.html
index 32e7e12f0a..78f24a5e80 100644
--- a/Tests/LibWeb/Text/input/document-computed-mimetype.html
+++ b/Tests/LibWeb/Text/input/document-computed-mimetype.html
@@ -2,23 +2,37 @@