diff --git a/django/template/defaulttags.py b/django/template/defaulttags.py
index fc8baf9611..4f3a5fb3ef 100644
--- a/django/template/defaulttags.py
+++ b/django/template/defaulttags.py
@@ -770,11 +770,15 @@ def firstof(parser, token):
{% firstof var1 var2 var3 "fallback value" %}
- If you want to escape the output, use a filter tag::
+ If you want to disable auto-escaping of variables you can use::
- {% filter force_escape %}
- {% firstof var1 var2 var3 "fallback value" %}
- {% endfilter %}
+ {% autoescape off %}
+ {% firstof var1 var2 var3 "fallback value" %}
+ {% autoescape %}
+
+ Or if only some variables should be escaped, you can use::
+
+ {% firstof var1 var2|safe var3 "fallback value"|safe %}
"""
bits = token.split_contents()[1:]