diff --git a/django/utils/html.py b/django/utils/html.py
index 06e8824f56..22d3ae42fa 100644
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -16,25 +16,27 @@ from django.utils.safestring import SafeData, SafeString, mark_safe
from django.utils.text import normalize_newlines
# https://html.spec.whatwg.org/#void-elements
-VOID_ELEMENTS = {
- "area",
- "base",
- "br",
- "col",
- "embed",
- "hr",
- "img",
- "input",
- "link",
- "meta",
- "param",
- "source",
- "track",
- "wbr",
- # Deprecated tags.
- "frame",
- "spacer",
-}
+VOID_ELEMENTS = frozenset(
+ (
+ "area",
+ "base",
+ "br",
+ "col",
+ "embed",
+ "hr",
+ "img",
+ "input",
+ "link",
+ "meta",
+ "param",
+ "source",
+ "track",
+ "wbr",
+ # Deprecated tags.
+ "frame",
+ "spacer",
+ )
+)
@keep_lazy(SafeString)