diff --git a/changelog.d/11596.misc b/changelog.d/11596.misc
new file mode 100644
index 0000000000000000000000000000000000000000..3064bc632d57b06beffab1ac19bfe8b21f08128e
--- /dev/null
+++ b/changelog.d/11596.misc
@@ -0,0 +1 @@
+Update black version and run it on all the files.
\ No newline at end of file
diff --git a/pyproject.toml b/pyproject.toml
index 8bca1fa4efd9028fa64c6896b7cb38ece33156e6..963f149c6af6e08a3c44757879607949d0d4489a 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -35,7 +35,7 @@
         showcontent = true
 
 [tool.black]
-target-version = ['py36']
+target-version = ['py37', 'py38', 'py39', 'py310']
 exclude = '''
 
 (
diff --git a/setup.py b/setup.py
index e113da6782d6f355a8571a6f5cfe953133d986bc..fbb0133016a7a773f314f9cebc2ade4c760fad4c 100755
--- a/setup.py
+++ b/setup.py
@@ -96,7 +96,7 @@ CONDITIONAL_REQUIREMENTS["all"] = list(ALL_OPTIONAL_REQUIREMENTS)
 # We pin black so that our tests don't start failing on new releases.
 CONDITIONAL_REQUIREMENTS["lint"] = [
     "isort==5.7.0",
-    "black==21.6b0",
+    "black==21.12b0",
     "flake8-comprehensions",
     "flake8-bugbear==21.3.2",
     "flake8",
diff --git a/synapse/logging/context.py b/synapse/logging/context.py
index 25e78cc82fcd408a887502e6d8407c962079c82c..d4ee89337642f7bd68d334399c39c3e5175b982f 100644
--- a/synapse/logging/context.py
+++ b/synapse/logging/context.py
@@ -68,7 +68,6 @@ try:
     def get_thread_resource_usage() -> "Optional[resource.struct_rusage]":
         return resource.getrusage(RUSAGE_THREAD)
 
-
 except Exception:
     # If the system doesn't support resource.getrusage(RUSAGE_THREAD) then we
     # won't track resource usage.
diff --git a/synapse/util/caches/lrucache.py b/synapse/util/caches/lrucache.py
index eb96f7e665e64d77f1418b05e7a00a7c8a36556b..3f11a2f9dd5cda816ab1e0834302425f854666b6 100644
--- a/synapse/util/caches/lrucache.py
+++ b/synapse/util/caches/lrucache.py
@@ -69,7 +69,6 @@ try:
         sizer.exclude_refs((), None, "")
         return sizer.asizeof(val, limit=100 if recurse else 0)
 
-
 except ImportError:
 
     def _get_size_of(val: Any, *, recurse: bool = True) -> int: