diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000000000000000000000000000000000000..87a2c3a9c0ad24ddfbbbff0dc51d64765dcad59a
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,18 @@
+# This file should be kept in sync with the one in dynare.git (which also
+# contains more explanations).
+Language: Cpp
+Standard: c++20
+ColumnLimit: 100
+BasedOnStyle: GNU
+AllowShortFunctionsOnASingleLine: InlineOnly
+AlwaysBreakTemplateDeclarations: Yes
+BreakConstructorInitializers: AfterColon
+BreakInheritanceList: AfterColon
+Cpp11BracedListStyle: true
+DeriveLineEnding: false
+IndentPPDirectives: AfterHash
+PPIndentWidth: 1
+PointerAlignment: Left
+SpaceAfterTemplateKeyword: false
+SpaceBeforeParens: ControlStatements
+SpaceBeforeCpp11BracedList: true
diff --git a/meson.build b/meson.build
index 22346a6baaf2fb48234024b0f11610ff2c682722..4ee79d0e8588afc9902417e1e256f1f9276b5769 100644
--- a/meson.build
+++ b/meson.build
@@ -3,6 +3,7 @@
 
 project('dynare-preprocessor', 'cpp',
         version : '6-unstable',
+        # NB: update C++ standard in .clang-format whenever the following is modified
         default_options : [ 'cpp_std=gnu++20', 'warning_level=2' ],
         meson_version : '>=0.64.0')