diff --git a/Tests/LibWeb/Text/expected/SVG/svg-viewbox-zero-height.txt b/Tests/LibWeb/Text/expected/SVG/svg-viewbox-zero-height.txt
new file mode 100644
index 00000000000..3a2d263b041
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/SVG/svg-viewbox-zero-height.txt
@@ -0,0 +1 @@
+ PASS (didn't crash)
diff --git a/Tests/LibWeb/Text/input/SVG/svg-viewbox-zero-height.html b/Tests/LibWeb/Text/input/SVG/svg-viewbox-zero-height.html
new file mode 100644
index 00000000000..618fa25327b
--- /dev/null
+++ b/Tests/LibWeb/Text/input/SVG/svg-viewbox-zero-height.html
@@ -0,0 +1,10 @@
+
+
+
diff --git a/Userland/Libraries/LibWeb/Layout/SVGSVGBox.cpp b/Userland/Libraries/LibWeb/Layout/SVGSVGBox.cpp
index 3b19d2eec7c..6baa12a5c2e 100644
--- a/Userland/Libraries/LibWeb/Layout/SVGSVGBox.cpp
+++ b/Userland/Libraries/LibWeb/Layout/SVGSVGBox.cpp
@@ -73,7 +73,11 @@ Optional SVGSVGBox::calculate_intrinsic_aspect_ratio() const
auto const& viewbox = dom_node().view_box().value();
// 2. return viewbox.width / viewbox.height
- return CSSPixels::nearest_value_for(viewbox.width) / CSSPixels::nearest_value_for(viewbox.height);
+ auto height = CSSPixels::nearest_value_for(viewbox.height);
+ if (height != 0)
+ return CSSPixels::nearest_value_for(viewbox.width) / CSSPixels::nearest_value_for(viewbox.height);
+
+ return {};
}
// 4. return null