Windows Setup

How to Set Up a Minecraft Server on Windows: A Guide

Tech Setup6 min read
TS

Tech Setup

Published August 3, 2026 · Editorial policy

How to Set Up a Minecraft Server on Windows: A Guide

Introduction

Running a local Minecraft server on Windows is a straightforward process, but configuring it for performance, security, and persistence requires a methodical approach. Whether you are spinning up a private instance for a small group of developers or testing custom plugin hooks, deploying a dedicated server directly on Windows gives you fine-grained control over file systems, memory allocation, and networking.

In this guide, we will walk through the complete lifecycle of setting up a Java Edition Minecraft server on a Windows host (Windows 10 or 11, or Windows Server 2019/2022). We will bypass unnecessary GUI abstractions and focus on the command-line workflows, environment configurations, and networking rules required to keep a server stable.

Prerequisites

Before downloading binaries, ensure your Windows environment meets the necessary runtime and hardware criteria.

Hardware and OS Requirements

  • Operating System: Windows 10/11 (64-bit) or Windows Server.
  • CPU: Quad-core processor running at 3.0 GHz or higher. Minecraft’s core game loop relies heavily on single-thread CPU performance.
  • RAM: Minimum 8GB system RAM (allocating 4GB to 6GB explicitly to the Java Virtual Machine for a small vanilla instance).
  • Storage: Solid State Drive (SSD) or NVMe. World save operations (region file I/O) will bottleneck quickly on traditional spinning hard drives.

Software Requirements

You must have the appropriate Java Development Kit (JDK) installed. Minecraft 1.20.5 and later require Java 17. Minecraft 1.20.5+ requires Java 21.

Verify your current Java installation by opening PowerShell and running:

java -version

If Java is missing or outdated, install the latest Eclipse Temurin OpenJDK distribution via winget:

winget install EclipseAdoptium.JDK.21.HotSpot

Restart your terminal session after installation to ensure the JAVA_HOME environment variables and system PATH update correctly.


Step 1: Directory Structure and Server Binaries

Keeping your server environment organized prevents permission issues and simplifies backups.

  1. Create a dedicated directory for your server. Open PowerShell and run:
    New-Item -ItemType Directory -Path "C:\MinecraftServer"
    cd C:\MinecraftServer
    
  2. Download the official server .jar file from Mojang. You can fetch it directly via PowerShell using Invoke-WebRequest (replace the URL with the specific version release URL if you are pinning to an older version):
    Invoke-WebRequest -Uri "https://piston-data.mojang.com/v1/objects/c9df48efed58511c60f10697ae84323c6158d200/server.jar" -OutFile "server.jar"
    

Step 2: Initializing and Accepting the EULA

Running the server jar for the first time will generate the necessary configuration files and prompt you to accept the End User License Agreement.

  1. Execute the jar via the command line to trigger initialization:

    java -Xmx2G -Xms2G -jar server.jar nogui
    

    Note: -Xmx2G and -Xms2G allocate a static 2GB of RAM to the heap. You will adjust this later.

  2. The application will run briefly, generate several files, and shut down because the EULA has not been accepted. Open the newly generated eula.txt file in your preferred text editor (e.g., Notepad or VS Code):

    notepad eula.txt
    
  3. Locate the final line and change the boolean value from false to true:

    eula=true
    
  4. Save and close the file.


Step 3: Configuring Server Properties

The server.properties file dictates game rules, networking parameters, and performance boundaries. Open it for editing:

notepad server.properties

Review and adjust the following key configuration properties for a standard, performant setup:

# Networking
server-port=25565
server-ip=

# Gameplay
gamemode=survival
difficulty=normal
pvp=true
hardcore=false
max-players=20
view-distance=10
simulation-distance=10

# Performance & Security
enable-command-block=false
online-mode=true
white-list=false
spawn-protection=16

Critical Settings Breakdown:

  • server-ip: Leave this blank. It binds the server to all available network interfaces on the Windows host machine.
  • online-mode=true: Ensures Mojang authentication is enforced. Set to false only if you are running an offline development environment without auth servers (not recommended for production).
  • view-distance & simulation-distance: Lowering these values (e.g., from 12 down to 8 or 10) drastically reduces CPU and RAM overhead on the server thread.

Step 4: Crafting the Startup Script

Rather than typing out lengthy Java arguments every time you boot the server, create a robust batch script or PowerShell script.

Create a file named start.bat in your C:\MinecraftServer directory:

New-Item -ItemType File -Path "C:\MinecraftServer\start.bat"

Populate start.bat with the following production-grade JVM arguments optimized for garbage collection and memory stability:

@echo off
REM === Minecraft Server Startup Script ===

:: Set window title
title Minecraft Dedicated Server

:: Define Memory Limits (adjust based on system RAM)
SET MEM_SIZE=4G

java -Xmx%MEM_SIZE% -Xms%MEM_SIZE% ^
-XX:+UseG1GC ^
-XX:+ParallelRefProcEnabled ^
-XX:MaxGCPauseMillis=200 ^
-XX:+UnlockExperimentalVMOptions ^
-XX:+DisableExplicitGC ^
-XX:G1NewSizePercent=30 ^
-XX:G1MaxNewSizePercent=40 ^
-XX:G1HeapRegionSize=8M ^
-XX:G1ReservePercent=20 ^
-XX:G1HeapWastePercent=5 ^
-XX:G1MixedGCCountTarget=4 ^
-XX:InitiatingHeapOccupancyPercent=15 ^
-XX:G1MixedGCLiveThresholdPercent=90 ^
-XX:G1RSetUpdatingPauseTimePercent=5 ^
-XX:SurvivorRatio=32 ^
-Dusing.aikars.flags=https://mcflags.emc.gs ^
-Daikars.new.flags=true ^
-jar server.jar nogui

pause

Save the file. This script utilizes Aikar's flags, which are widely considered the gold standard for tuning the Garbage Collector (G1GC) in Minecraft environments to prevent massive lag spikes caused by memory cleanups.

Double-click start.bat (or execute it via terminal) to test the boot sequence.


Step 5: Network Configuration and Port Forwarding

To allow external players to connect to your Windows server, you must configure both local Windows Firewall rules and your home/office router's NAT settings.

Configuring Windows Firewall

Open PowerShell as an Administrator and create inbound and outbound rules allowing traffic on TCP port 25565:

New-NetFirewallRule -DisplayName "Minecraft Server TCP Inbound" -Direction Inbound -LocalPort 25565 -Protocol TCP -Action Allow
New-NetFirewallRule -DisplayName "Minecraft Server TCP Outbound" -Direction Outbound -RemotePort 25565 -Protocol TCP -Action Allow

Router Port Forwarding

  1. Find your local machine's internal IPv4 address by running ipconfig in PowerShell and noting the IPv4 Address under your active adapter (e.g., 192.168.1.150).
  2. Log into your router's administration panel (commonly found at 192.168.1.1 or 192.168.0.1).
  3. Navigate to the Port Forwarding or Virtual Server section.
  4. Create a new rule:
    • Service Name: Minecraft
    • External Port: 25565
    • Internal Port: 25565
    • Internal IP Address: Your machine's IPv4 address (192.168.1.150)
    • Protocol: TCP (or Both/TCP/UDP)

External players will now connect to your public IP address (obtainable via icanhazip.com). Local players on the same network can connect using localhost or your local IPv4 address.


Step 6: Running as a Windows Service (Optional Production Step)

Running the server via a batch file requires an active logged-in Windows user session. For a true persistent background server, wrap the process in a Windows Service using NSSM (Non-Sucking Service Manager).

  1. Install NSSM via winget:
    winget install NSSM.NSSM
    
  2. Open an Administrator PowerShell prompt and invoke the GUI configuration tool:
    nssm install MinecraftServer
    
  3. In the NSSM configuration window:
    • Path: C:\Program Files\Eclipse Adoptium\jdk-21.x.x\bin\java.exe (or your absolute path to java.exe).
    • Startup directory: C:\MinecraftServer
    • Arguments: -Xmx4G -Xms4G -XX:+UseG1GC -jar server.jar nogui (Include your chosen JVM flags here).
  4. Click Install service.

You can now manage the server lifecycle via standard Windows service commands:

Start-Service MinecraftServer
Stop-Service MinecraftServer
Restart-Service MinecraftServer

Step 7: Post-Setup Validation and Maintenance

With your server operational, implement a maintenance routine to prevent data loss and monitor performance.

Operator Management

Grant yourself administrative privileges (op status) within the server console window:

op YourUsername

Automated Backups

World corruption can occur due to unexpected host reboots or power outages. Create a basic PowerShell backup script (backup.ps1) to archive your world directory:

$Source = "C:\MinecraftServer\world"
$Destination = "C:\MinecraftServer\backups\world_$(Get-Date -Format 'yyyy-MM-dd_HH-mm').zip"

# Ensure backup directory exists
If (!(Test-Path "C:\MinecraftServer\backups")) {
    New-Item -ItemType Directory -Path "C:\MinecraftServer\backups"
}

# Compress world directory
Compress-Archive -Path $Source -DestinationPath $Destination -CompressionLevel Optimal
Write-Host "Backup completed successfully at $Destination" -ForegroundColor Green

You can automate this script using the Windows Task Scheduler to run hourly or daily without interrupting server operations.


Conclusion

You now have a fully operational, tuned Minecraft server running on Windows. From here, you can explore installing server wrappers like PaperMC or Purpur for advanced plugin support (Spigot/Paper plugins), or map out automated monitoring tools like Prometheus and Grafana via the JVM metrics exporter if you are scaling up your developer infrastructure.