Rate Limit Calculator

Calculate Discord API rate limits, request quotas, and optimal cooldown timings for your bot. Avoid 429 errors and optimize performance.

Sending messages in a channel

Rate Limit Details

Limit
5
requests
Window
5
seconds
Bucket
channel
scope
Category
Messages
type

Calculated Metrics

Requests per Second
1.00
Requests per Minute
60
Requests per Hour
3600
Optimal Delay
1000ms
Time Estimate

Making 10 requests to Send Message will take approximately:

10.0 seconds
// Discord.js - Rate Limit Handling

// Discord.js automatically handles rate limits
// You don't need to manually implement delays

const { REST } = require('@discordjs/rest');
const rest = new REST({ version: '10' }).setToken('YOUR_BOT_TOKEN');

// Example: Send multiple messages with automatic rate limit handling
async function sendMultipleMessages(channel, messages) {
  for (const content of messages) {
    try {
      await channel.send(content);
      // Discord.js automatically waits if rate limited
    } catch (error) {
      if (error.code === 429) {
        // Rate limited - Discord.js will retry automatically
        console.log('Rate limited, waiting...');
      } else {
        console.error('Error:', error);
      }
    }
  }
}

// Listen for rate limit events
client.rest.on('rateLimited', (info) => {
  console.log(`Rate limited on route ${info.route}`);
  console.log(`Retry after: ${info.timeToReset}ms`);
  console.log(`Limit: ${info.limit}`);
  console.log(`Global: ${info.global}`);
});

// Manual delay for custom logic (1000ms for Send Message)
async function sendWithDelay(channel, messages) {
  for (const content of messages) {
    await channel.send(content);
    await new Promise(resolve => setTimeout(resolve, 1000));
  }
}
ℹ️

Global Rate Limit

Discord has a global rate limit of 50 requests per second across all endpoints. Libraries handle this automatically.

⚠️

429 Status Code

When rate limited, Discord returns HTTP 429. The response includes a Retry-After header indicating wait time.

Understanding Discord Rate Limits

Discord's API uses rate limiting to prevent abuse and ensure platform stability. Rate limits restrict how many requests you can make to specific endpoints within a time window. When you exceed these limits, Discord returns a 429 (Too Many Requests) status code.

Understanding rate limits is crucial for building reliable bots that don't get temporarily banned or cause poor user experiences due to failed requests.

Types of Rate Limits

Global Rate Limit

A hard limit of 50 requests per second across all API endpoints. This applies to your entire bot, not per-endpoint.

X-RateLimit-Global: true

Indicates you've hit the global rate limit. Rare with proper implementation.

Per-Route Rate Limits

Each API endpoint has its own rate limit. Similar endpoints share rate limit "buckets."

Send Message: 5 per 5s per channel
Add Reaction: 1 per 0.25s
Ban Member: 5 per 5s per guild

Bucket System

Discord groups similar endpoints into "buckets" that share rate limits. For example, all message sending in one channel shares the same bucket.

  • Channel bucket: Per-channel limits (messages, reactions)
  • Guild bucket: Per-guild limits (moderation, roles)
  • Webhook bucket: Per-webhook limits

Rate Limit Headers

Discord includes rate limit information in response headers. Modern libraries parse these automatically, but understanding them helps with debugging:

X-RateLimit-Limit

The total number of requests allowed in the rate limit window.

X-RateLimit-Remaining

Number of requests remaining before hitting the limit.

X-RateLimit-Reset

Unix timestamp (seconds) when the rate limit resets.

Retry-After

Seconds to wait before retrying (only present on 429 responses).

Best Practices

Use a Library

Discord.js and Discord.py handle rate limits automatically. They queue requests and respect rate limit headers, so you rarely need manual implementation.

⏱️

Implement Delays for Bulk Operations

When sending many messages or performing bulk actions, add delays between requests. Use the optimal delay calculated by this tool.

📦

Batch Operations When Possible

Use bulk operations like bulk delete messages (up to 100 messages) instead of deleting one at a time. This uses fewer requests and is faster.

🔄

Cache Data

Cache frequently accessed data (guild members, roles, channels) instead of fetching it repeatedly. This reduces API calls and improves performance.

🎯

Use Webhooks for Announcements

Webhooks have separate rate limits and are better for sending multiple messages. Use them for announcements, logs, or automated posts.

⚠️

Handle 429 Errors Gracefully

Always handle 429 errors. Respect the Retry-After header and wait before retrying. Don't immediately retry or you'll extend the rate limit.

📊

Monitor Rate Limit Usage

Log rate limit events during development to identify bottlenecks. Most libraries provide rate limit events you can listen to.

🚫

Avoid Unnecessary Requests

Don't fetch data you already have. Use events to track changes instead of polling. Every saved request is one more you can use for actual features.

Common Rate Limit Scenarios

💬

Mass Message Sending

Sending announcements to multiple channels or users.

Limit: 5 messages per 5s per channel
Solution: Add 1-second delays between messages
🗑️

Purging Messages

Deleting many messages from a channel.

Limit: 1 bulk delete per 1s
Solution: Use bulkDelete() for 2-100 messages

Adding Many Reactions

Creating reaction role messages with multiple emojis.

Limit: 1 reaction per 0.25s
Solution: Wait 300ms between each reaction
👥

Bulk Role Updates

Assigning roles to many members at once.

Limit: 10 updates per 10s per guild
Solution: Process in batches with 1s delays

Consequences of Ignoring Rate Limits

Temporary Bans: Repeatedly hitting rate limits can result in temporary API bans (minutes to hours)
Failed Requests: 429 errors mean your request failed and users don't get expected responses
Poor Performance: Constant retries waste resources and slow down your bot
User Frustration: Commands failing or being slow creates a bad user experience
Potential Blacklisting: Severe or repeated abuse can lead to bot blacklisting