diff --git a/packages/web-twig/src/Resources/components/Checkbox/Checkbox.twig b/packages/web-twig/src/Resources/components/Checkbox/Checkbox.twig
index 4240ed88d1..7a46474136 100644
--- a/packages/web-twig/src/Resources/components/Checkbox/Checkbox.twig
+++ b/packages/web-twig/src/Resources/components/Checkbox/Checkbox.twig
@@ -33,6 +33,7 @@
{# Attributes #}
{%- set _checkedAttr = _isChecked ? 'checked' : null -%}
{%- set _disabledAttr = _isDisabled ? 'disabled' : null -%}
+{%- set _nameAttr = _name ? 'name="' ~ _name | escape('html_attr') ~ '"' : null -%}
{%- set _requiredAttr = _isRequired ? 'required' : null -%}
{%- set _valueAttr = _value ? 'value=' ~ _value : null -%}
@@ -53,10 +54,10 @@
{{ inputProps(props, _allowedInputAttributes, _inputProps) }}
type="checkbox"
id="{{ _id }}"
- name="{{ _name }}"
class="{{ _inputClassName }}"
{{ _checkedAttr }}
{{ _disabledAttr }}
+ {{ _nameAttr | raw }}"
{{ _requiredAttr }}
{{ _valueAttr }} {# Intentionally without `raw` to prevent XSS. #}
/>
diff --git a/packages/web-twig/src/Resources/components/Checkbox/__tests__/__fixtures__/checkboxDefault.twig b/packages/web-twig/src/Resources/components/Checkbox/__tests__/__fixtures__/checkboxDefault.twig
index e22285addd..efd59c286c 100644
--- a/packages/web-twig/src/Resources/components/Checkbox/__tests__/__fixtures__/checkboxDefault.twig
+++ b/packages/web-twig/src/Resources/components/Checkbox/__tests__/__fixtures__/checkboxDefault.twig
@@ -1,3 +1,49 @@
-{% set inputProps = { "data-validate": "true" } %}
+