Free hosting
Minecraft JavaMinecraft BedrockPaperMCFabricForgeGeyserMCTerrariaFactorioHytaleDiscord botsRLCraftCobblemonBetter MCCreate
Go premium

No hibernation, no timers, 5 GHz CPUs and up to 32 GB RAM.

From €1.99/month →
Tools & help
RAM calculatorMOTD generatorServer status checkerserver.properties generatorColor codesGuidesDiscord community
Language
EnglishNederlandsEspañolFrançaisDeutschItalianoPortuguêsLatviešuPolskiSuomiNorskRomânăPortuguês (BR)Türkçeहिन्दी
Start free
Discord · Python

How to Host a discord.py Bot for Free (24/7, 2026)

Your discord.py bot works on your PC. Here is how to move it to a server so it stays online when your computer is off, without exposing your token.

FreeGameHost logo FreeGameHost Guides Updated 7 min read

Quick answer

  1. Put your packages in requirements.txt; the server installs them on every start.
  2. Keep the token in a .env file and load it with python-dotenv, never in your code or on GitHub.
  3. Set the bot file (default bot.py) on the Startup page and press Start.

Prepare your project#

requirements.txt
discord.py>=2.4
python-dotenv
bot.py
import os
import discord
from dotenv import load_dotenv

load_dotenv()
intents = discord.Intents.default()
intents.message_content = True  # also enable it in the Developer Portal

client = discord.Client(intents=intents)

@client.event
async def on_ready():
    print(f"Logged in as {client.user}")

@client.event
async def on_message(message):
    if message.author.bot:
        return
    if message.content == "!ping":
        await message.channel.send("pong")

client.run(os.environ["DISCORD_TOKEN"])
.env (never commit this)
DISCORD_TOKEN=your-bot-token-here

If your bot reads message text, turn on Message Content Intent under Bot in the Discord Developer Portal, or message.content will be empty.

Deploy it#

  1. Create the bot server

    On free Discord bot hosting, create a server and choose Python. You can pick the Python version (3.7 to 3.13) on the Startup page.

  2. Upload or connect GitHub

    Upload bot.py, requirements.txt and .env with the file manager or SFTP. Or set Git Repo Address and Git Branch on the Startup page and reinstall; with Auto Update on, every start runs git pull. Upload .env separately so the token never touches GitHub.

  3. Set the bot file

    Check that Bot py file matches your main file name.

  4. Start

    Press Start. The Console shows pip installing your packages, then "Logged in as ...".

Free Python bot hosting256 MB RAM, Python 3.7-3.13, GitHub deploys. No credit card.
Host my bot

Keeping it online#

Bot servers don't sleep. Free servers run on a timer: each click on Renew adds 12 hours, up to 48 hours stored, as often as you like. Renewing once or twice a day keeps the bot running around the clock. If the bot crashes, the Console shows the Python traceback; fix the code and press Restart.

Slash commands#

For slash commands use discord.app_commands with a CommandTree and call await tree.sync() once (for example in setup_hook). Global commands can take a while to appear; syncing to one test server is instant.

Building your first bot? See how to make a Discord bot. Writing in JavaScript instead? See how to host a discord.js bot.

Related: Free Discord Bot Hosting  •  Free Minecraft Server Hosting

Frequently asked questions#

Is 256 MB enough for a discord.py bot?

Yes for most bots: moderation, utility, tickets and economy bots use far less. Music bots with Lavalink need more.

How do I keep my token safe?

Put it in a .env file on the server and load it with python-dotenv. Add .env to .gitignore so it never reaches GitHub.

Does the bot restart after an update?

With Auto Update on and a GitHub repo set, press Restart and the server pulls the latest code before starting.