diff --git a/django/forms/forms.py b/django/forms/forms.py
index 97a344e9fc..a0dcaab531 100644
--- a/django/forms/forms.py
+++ b/django/forms/forms.py
@@ -621,6 +621,12 @@ class BoundField(object):
id_for_label = widget.id_for_label(id_)
if id_for_label:
attrs = dict(attrs or {}, **{'for': id_for_label})
+ if self.field.required and hasattr(self.form, 'required_css_class'):
+ attrs = attrs or {}
+ if 'class' in attrs:
+ attrs['class'] += ' ' + self.form.required_css_class
+ else:
+ attrs['class'] = self.form.required_css_class
attrs = flatatt(attrs) if attrs else ''
contents = format_html('', attrs, contents)
else:
diff --git a/docs/ref/forms/api.txt b/docs/ref/forms/api.txt
index cb6cf7a51b..53e47ed0c2 100644
--- a/docs/ref/forms/api.txt
+++ b/docs/ref/forms/api.txt
@@ -511,10 +511,19 @@ classes, as needed. The HTML will look something like::
>>> f = ContactForm(data)
>>> print(f.as_table())
-
...
- |
---|
...
- |
---|
...
+ |
---|
...
+ |
---|
...
+ |
---|
...
|
---|
|
---|