diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6c32d349251d3370c0953f6bc55962d860822239..700bf0b119fd4a5f24c3dfcf941b2120464d4cd8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,6 +11,7 @@ that users understand how the changes affect the new version.
 
 version 5.0.0-dev
 ---------------------------
++ bcftools: add tmpDir input to specify temporary directory when sorting.
 + bcftools: remove outputType and implement indexing based on output file extension. 
 + NanoPack: Add parameter_meta to NanoPlot task.
 + Centrifuge: Remove metrics file from classification (which causes the
diff --git a/bcftools.wdl b/bcftools.wdl
index e2251331254c8f7d0f4ce44f19f677f0a9b67056..a0aeb44258e6d133fb7b97355287921574bbeceb 100644
--- a/bcftools.wdl
+++ b/bcftools.wdl
@@ -127,6 +127,7 @@ task Sort {
     input {
         File inputFile
         String outputPath = "output.vcf.gz"
+        String tmpDir = "./sorting-tmp"
         String memory = "256M"
         Int timeMinutes = 1 + ceil(size(inputFile, "G"))
         String dockerImage = "quay.io/biocontainers/bcftools:1.10.2--h4f4756c_2"
@@ -136,10 +137,11 @@ task Sort {
 
     command {
         set -e
-        mkdir -p "$(dirname ~{outputPath})"
+        mkdir -p "$(dirname ~{outputPath})" ~{tmpDir}
         bcftools sort \
         -o ~{outputPath} \
         -O ~{true="z" false="v" compressed} \
+        -T ~{tmpDir} \
         ~{inputFile}
 
         ~{if compressed then 'bcftools index --tbi ~{outputPath}' else ''}
@@ -159,6 +161,7 @@ task Sort {
     parameter_meta {
         inputFile: {description: "A vcf or bcf file.", category: "required"}
         outputPath: {description: "The location the output VCF file should be written.", category: "common"}
+        tmpDir: {description: "The location of the temporary files during the bcftools sorting.", category: "advanced"}
         memory: {description: "The amount of memory this job will use.", category: "advanced"}
         timeMinutes: {description: "The maximum amount of time the job will run in minutes.", category: "advanced"}
         dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}