diff --git a/xsdata/formats/dataclass/serializers/xml.py b/xsdata/formats/dataclass/serializers/xml.py
index 487ce89d..7a0e88f7 100644
--- a/xsdata/formats/dataclass/serializers/xml.py
+++ b/xsdata/formats/dataclass/serializers/xml.py
@@ -161,8 +161,8 @@ class XmlSerializer(AbstractSerializer):
     def write_tokens(self, value: Any, var: XmlVar, namespace: NoneStr) -> Generator:
         """Produce an events stream for the given tokens list or list of tokens
         lists."""
-        if value:
-            if isinstance(value[0], list):
+        if value or var.nillable:
+            if value and isinstance(value[0], list):
                 for val in value:
                     yield from self.write_element(val, var, namespace)
             else:

diff --git a/tests/formats/dataclass/serializers/test_xml.py b/tests/formats/dataclass/serializers/test_xml.py
index 10f1a9fe..7f065a9e 100644
--- a/tests/formats/dataclass/serializers/test_xml.py
+++ b/tests/formats/dataclass/serializers/test_xml.py
@@ -167,6 +167,17 @@ class XmlSerializerTests(TestCase):
         result = self.serializer.write_value([[1, 2, 3], [4, 5, 6]], var, "xsdata")
         self.assertEqual(expected, list(result))
 
+        var = XmlElement(qname="a", name="a", tokens=True, nillable=True)
+        expected = [
+            (XmlWriterEvent.START, "a"),
+            (XmlWriterEvent.ATTR, QNames.XSI_NIL, "true"),
+            (XmlWriterEvent.DATA, []),
+            (XmlWriterEvent.END, "a"),
+        ]
+
+        result = self.serializer.write_value([], var, "xsdata")
+        self.assertEqual(expected, list(result))
+
     def test_write_any_type_with_primitive(self):
         var = XmlWildcard(qname="a", name="a")
         expected = [(XmlWriterEvent.DATA, "str")]

XmlSerializer render empty nillable tokens lists
tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_tokens
tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_next_attribute tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_next_value tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_render_mixed_content tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_any_type_with_generic_object tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_any_type_with_primitive tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_any_type_with_primitive_element tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_choice_when_no_matching_choice_exists tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_choice_with_derived_dataclass tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_choice_with_derived_primitive_value tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_choice_with_generic_object tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_choice_with_raw_value tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_data tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_dataclass tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_dataclass_can_overwrite_params tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_dataclass_with_no_dataclass tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_element tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_element_with_any_type_var tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_element_with_any_type_var_ignore_xs_string tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_element_with_nillable_true tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_mixed_content tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_object_with_derived_element tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_value_with_list_value tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_value_with_unhandled_xml_var tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_xsi_type tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_xsi_type_with_derived_class tests/formats/dataclass/serializers/test_xml.py::XmlSerializerTests::test_write_xsi_type_with_illegal_derived_class