Before we start, it's important to note that when running your own Minecraft server, you will need to use your own hardware, your own network and your own power. Hosting a server from home entails running a computer 24/7 which can rack up some hefty network and power bills, and if you want it to perform well then hardware could cost a pretty penny too. If this all seems good then we can continue, if not you can check out our server hosting review page for Minecraft for some better prices.
This guide will be made for Windows as you will want a desktop with good hardware to run a server. First off, go to https://www.minecraft.net/en-us/download/server and download the .jar file, we will need this file to start. If you want a server on a different version of Minecraft go to https://mcversions.net/ on the left panel click the version of Minecraft you want your server to be on and click download server jar.
Once downloaded, place the .jar file in a folder on your desktop (it doesn't need to be on your desktop but for easy access you should place it on the desktop). Right click and make a new text file and copy and paste the command:
java -Xms<RAM> -Xmx<RAM> -jar <SERVER .JAR NAME>.jar
IMPORTANT: Replace both <RAM> sections with the amount of RAM you want to dedicate. For most servers just replace this with 2G but if you want more performance use half of the RAM your PC has. Also replace <SERVER .JAR NAME> with whatever the downloaded .jar file is called. For a 4GB server with the .jar file named server.jar the command will look like this:
java -Xms4G -Xmx4G -jar server.jar
Next, click file at the top of the window, click save as and name the file "run.bat" and in the file type, click the drop down and select "all file types" and click save. Exit this text file and double click the newly made run.bat file. Be patient and this will create some files in the folder but we aren't done yet. Double click the eula.txt and change eula=false to eula=true and save the file.
Now, we double click the run.bat and the server is up. To test the server you can go into Minecraft and enter localhost into the server IP section and you can play your server. For people outside of your server however, you will have to port forward. Guides vary on how to port forward due to the large range of internet service providers but https://portforward.com/router.htm has great guides on how to port forward on multiple routers. For both ports when port forwarding enter 25565 and for IP input your PC's IP address which can be found by going to cmd and typing ipconfig. Your IP will be under ipv4 address. Once this new rule is created you can search on google "what's my IP" and give whatever comes up to whoever you want to join.
IMPORTANT: Don't give your private IP address as no one outside of your network can connect with this. It must be your public IP address found on google.
EXTRA IMPORTANT: DO NOT GIVE YOUR IP TO PEOPLE YOU DONT TRUST! People can do malicious things with your IP address so be careful!
And that's it! If you've had trouble following this guide we're very sorry to hear that. Please consider checking out our server hosting reviews for cheaper options where you don't have to have a PC running 24/7. Enjoy!