How to Host a Discord Bot on Your PC for Free
You don't need to rent a server to run a Discord bot. Your own Windows, Mac or Linux computer can host it for free. This guide explains what hosting actually means, how to create and invite a bot, how to keep it running, and when paying for 24/7 hosting is worth it.
What "hosting a Discord bot" means
A Discord bot is a small program. Discord doesn't run it for you: the program runs on some computer, logs in to Discord with a secret token, and then listens for commands or posts messages. "Hosting" just means choosing which computer runs that program.
So the rule is simple: the bot is online only while its program is running. Close the window, shut down the PC or let it go to sleep, and the bot goes offline. Start it again, and it comes back.
Some "bots" are really scripts that post through a webhook, a link that lets a program post into one channel. Alert scripts like that don't need a token or a constant connection. They wake up on a timer, post, and stop.
Your PC or 24/7 hosting?
| Your own PC | A 24/7 host | |
|---|---|---|
| Cost | $0 | About $5–$8 a month for a small bot |
| Online | Only while the PC is on and awake | Around the clock |
| Setup | Easiest: nothing to sign up for | An account, a card and an upload |
| Best for | Trying a bot, small servers, a PC that's on most of the day | Busy servers, members in other time zones, scheduled posts |
Starting on your PC is a good idea even if you plan to move later. You'll know the bot works before you pay anyone.
Step 1: Create the bot in the Developer Portal
- Go to discord.com/developers/applications and log in with your Discord account.
- Click New Application, type a name, accept the terms and click Create. New apps get a bot user automatically.
- Click Bot in the left menu. Here you can set the bot's avatar and username.
- Under Privileged Gateway Intents, switch on only what your bot's instructions ask for. Message Content Intent is for bots that read messages, like moderation bots. Server Members Intent is for welcome messages and member lists. Click Save Changes.
Step 2: Copy the token and keep it secret
On the same Bot page, click Reset Token, confirm, and copy it. Discord shows it only once. If you lose it, reset it again.
The token is the bot's password. Anyone who has it can control your bot in every server it's in. Discord's docs put it simply: never share it or put it in version control.
- Never paste it into Discord, a screenshot, a forum post or a public GitHub repo.
- Keep it in a settings file next to the bot, usually called
.env, and never in the code itself. - If it ever leaks, click Reset Token straight away. The old token stops working instantly.
Step 3: Invite the bot to your server
Discord now builds the invite link for you on the Installation page:
- Click Installation in the left menu. Under Installation Contexts, make sure Guild Install is ticked. "Guild" is Discord's internal word for a server.
- Under Install Link, choose Discord Provided Link.
- In Default Install Settings → Guild Install, add the scopes
botandapplications.commands. The second one lets the bot register slash commands. - Pick the bot's permissions. Administrator is the quickest choice for a bot you run yourself and trust, because it never hits a missing-permission error. For tighter security, tick only what the bot needs instead, such as Send Messages, Embed Links and, for moderation, Manage Messages and Moderate Members.
- Click Save Changes, copy the link, open it in your browser, pick your server and click Authorize. You need the Manage Server permission in that server.
The bot now appears in your member list, but offline. That's normal: its program isn't running yet.
Step 4: Run it on your PC
How you start the bot depends on the language it's written in. Its README should say. The two most common:
# Python bot
pip install -r requirements.txt
python bot.py
# JavaScript (Node.js) bot
npm install
node index.js
Put the token in the .env file first, as the README describes. When the bot connects, most bots print a line like Logged in as YourBot, and the bot turns green (online) in Discord. Try one of its slash commands. Global slash commands can take a while to appear the first time. Bots that register commands for one server show up right away.
Don't have a bot yet? You can describe one in plain English and have an AI coding assistant write it: see our 8 starter prompts for making a Discord bot with AI.
Step 5: Keep it running
The bot runs as long as that window stays open and the computer stays awake. A few settings make a big difference:
- Stop the PC from sleeping. On Windows 11: Settings → System → Power & battery → Screen, sleep, & hibernate timeouts, then set "Make my device sleep after" to Never when plugged in. The screen can still turn off; that doesn't affect the bot.
- Start the bot when you log in. On Windows, open Task Scheduler, choose Create Basic Task, set the trigger to When I log on, and point it at the command that starts your bot. On Linux, a small systemd service does the same.
- Expect restarts. Updates and power cuts will stop the bot sometimes. A bot that saves what it already posted to a file won't repeat old alerts when it comes back.
- Laptops: closing the lid usually means sleep, so leave it open or change the lid setting.
When to pay for 24/7 hosting
Move the bot to a host when its downtime starts to bother your members: when your PC is off overnight but half the server is in another time zone, when scheduled posts get missed, or when people rely on moderation around the clock.
A small always-on bot costs roughly $5–$8 a month. These are the two we've written step-by-step instructions for (prices checked on their official pages on October 16, 2026):
- Render: about $7.25/month. The Starter background worker ($7) plus a 1 GB disk ($0.25). We tested this ourselves with a new account. Render's free tier is for websites that sleep when idle, so it doesn't suit an always-on bot.
- Railway: about $5/month. The Hobby plan includes $5 of usage, which covers a small bot. We haven't tested Railway with a new account yet.
Our deploy guide walks through both, click by click.
Want to skip the terminal?
Every BotDrop bot comes with a Windows one-click launcher that does Steps 1 to 5 with pictures: it checks your token, opens the right invite link, starts the bot and keeps it in the system tray, with an optional Start with Windows box. We tested it on a real Windows PC with the Gaming Community Kit; for our other bots it's still in beta. See how the launcher works.
Sources
- Discord Developer Docs: Building your first Discord Bot (app creation, token, Installation page, scopes)
- Discord Developer Docs: Gateway (intents)
- Microsoft Support: Power settings in Windows 11
- Render pricing (checked Oct 16, 2026)
- Railway pricing (checked Oct 16, 2026)
- Railway plans (checked Oct 16, 2026)