diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml
new file mode 100644
index 0000000000000000000000000000000000000000..1e63e0e3b7ad2ff6e03191bbdb8588b292107dfe
--- /dev/null
+++ b/config/checkstyle/checkstyle.xml
@@ -0,0 +1,19 @@
+<!DOCTYPE module PUBLIC
+          "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
+          "https://checkstyle.org/dtds/configuration_1_3.dtd">
+<module name="Checker">
+  <property name="tabWidth" value="4"/>
+  <property name="charset" value="UTF-8"/>
+  <module name="LineLength">
+    <property name="fileExtensions" value="java"/>
+    <property name="max" value="100"/>
+    <property name="ignorePattern" value="^package.*|^import.*|a href|href|http://|https://|ftp://"/>
+  </module>
+  <module name="TreeWalker">
+    <module name="RegexpSinglelineJava">
+      <property name="format" value="^\t* +\t*\S"/>
+      <property name="message" value="Line has leading space characters; indentation should be performed with tabs only."/>
+      <property name="ignoreComments" value="true"/>
+    </module>
+  </module>
+</module>
diff --git a/onionwrapper-android/build.gradle b/onionwrapper-android/build.gradle
index d1dd271c13dc8629990583f70e95ab5347207dfd..8b531a825de6c248cda747ad2fc3a354ab73c3e4 100644
--- a/onionwrapper-android/build.gradle
+++ b/onionwrapper-android/build.gradle
@@ -1,6 +1,7 @@
 plugins {
     id 'com.android.library'
     id 'com.vanniktech.maven.publish' version '0.18.0'
+    id 'checkstyle'
 }
 
 android {
@@ -27,6 +28,10 @@ android {
     }
 }
 
+checkstyle {
+    configFile = new File('../config/checkstyle/checkstyle.xml')
+}
+
 dependencies {
     api project(':onionwrapper-core')
     api 'org.briarproject:dont-kill-me-lib:0.2.7'
diff --git a/onionwrapper-core/build.gradle b/onionwrapper-core/build.gradle
index 7167ad514fb99003cad0f6a697f1f870cc7b3ede..2886fe4ffc41cbc85a19454a6f36b029c25e6c91 100644
--- a/onionwrapper-core/build.gradle
+++ b/onionwrapper-core/build.gradle
@@ -1,6 +1,7 @@
 plugins {
     id 'java-library'
     id 'com.vanniktech.maven.publish' version '0.18.0'
+    id 'checkstyle'
 }
 
 java {
@@ -8,6 +9,10 @@ java {
     targetCompatibility = JavaVersion.VERSION_1_8
 }
 
+checkstyle {
+    configFile = new File('../config/checkstyle/checkstyle.xml')
+}
+
 dependencies {
     api 'org.briarproject:null-safety:0.1'
     api 'com.google.code.findbugs:jsr305:3.0.2'
diff --git a/onionwrapper-java/build.gradle b/onionwrapper-java/build.gradle
index 1f043fad1bf6a1e43845709873154897820efcb8..913f000b25e6e8ecdefdbca470d2a10acf790042 100644
--- a/onionwrapper-java/build.gradle
+++ b/onionwrapper-java/build.gradle
@@ -5,6 +5,7 @@ import static org.briarproject.onionwrapper.OsUtils.currentOS
 plugins {
     id 'java-library'
     id 'com.vanniktech.maven.publish' version '0.18.0'
+    id 'checkstyle'
 }
 
 java {
@@ -12,6 +13,10 @@ java {
     targetCompatibility = JavaVersion.VERSION_1_8
 }
 
+checkstyle {
+    configFile = new File('../config/checkstyle/checkstyle.xml')
+}
+
 dependencies {
     api project(':onionwrapper-core')
     def jna_version = '4.5.2'