Cloudflare Docs
D1
Visit D1 on GitHub
Set theme to dark (⇧+D)

Pricing

D1’s billing is based on:

  • What you use: queries you issue against D1 will consume read units and/or write units depending on the volume of data read (scanned) or written.
  • Scale-to-zero: You are not billed for “hours” or “capacity units”: if you are not issuing queries against your database, you are only billed for storage above the included limits of your plan when your database is not in use.

​​ Billing metrics

Workers FreeWorkers Paid
Read units (per 4KB scanned)5 million / dayFirst 25 billion / month included + $0.001 / million units
Write units (per 1KB written)100,000 / dayFirst 50 million / month included + $1.00 / million units
Storage (per GB stored)1GB (total)First 5GB included + $0.75 / GB-mo

Notes:

  1. Read units measure how much data a query reads (scans), in units of 4 KB. For example, if you have a table with 5000 rows, with each row ~200 bytes, and run a SELECT * FROM table, your query would scan (5000 rows * 0.2KB / 4KB read unit) 1000 KB in total, or 250 read units.
  2. Write units measure how much data was written to a D1 database, in 1KB units. An INSERT of a single row of 1900 bytes — a userID, name, email address and comments field, for example — would count as two (2) write units (2KB).
  3. Both read and write units are rounded up to the nearest whole unit. A query that reads 1,000 rows of approximately 90 bytes (1000*.009 / 4), would consume 23 read units.
  4. Storage is based on gigabytes stored per month, and is based on the sum of all databases in your account. Tables and indexes both count towards storage consumed.
  5. Free limits reset daily at 00:00 UTC. Monthly included limits reset based on your monthly subscription renewal date, which is determined by the day you first subscribed.
  6. There are no data transfer (egress) or throughput (bandwidth) charges for data accessed from D1.

​​ Frequently Asked Questions

Frequently asked questions related to D1 pricing:

  • Will D1 always have a free tier?

Yes, the Workers free tier will always include the ability to prototype and experiment with D1 for free.

  • What happens if I exceed the daily limits on reads & writes, or the total storage limit, on the free tier?

When your account hits the daily read and/or write limits, you will not be able to issue queries against D1. The D1 API will return errors to your client indicating that your daily limits have been exceeded. Once you have reached your included storage limit, you will need to delete unused databases or clean up stale data before you can insert new data, create or alter tables or create indexes and triggers.

Upgrading to the Paid plan will remove these limits, typically within minutes.

  • What happens if I exceed the monthly included reads, writes and/or storage on the paid tier?

You will be billed for the additional reads, writes and storage according to D1’s pricing metrics.

  • When will D1 start billing me?

For Workers Paid tier users, we intend to start billing for additional usage beyond the included reads, writes and storage by (no earlier than) September 2023. We will notify all customers via email (the super administrator address on their account) prior to this change.

  • How can I estimate my (eventual) bill?

We’ll be adding analytics for read units, write units and storage at both the account level and per-database, so you can both track overall usage and assess which database(s) are contributing to your usage ahead of enabling any billing.

  • Does D1 charge for data transfer / egress?

No.

  • Does D1 charge additional for additional compute?

D1 itself does not charge for additional compute. Workers querying D1 and computing results: for example, serializing results into JSON and/or issuing queries, are billed per Workers pricing, in addition to your D1 specific usage.

  • Do queries I issue from the dashboard or wrangler (the CLI) count as billable usage?

Yes: any queries you issue against your database, including INSERTing existing data into a new database, table scans (SELECT * FROM table), or creating indexes count as either reads or writes.

  • Can I use an index to reduce the number of read units consumed?

Yes! Creating indexes for your most queried tables and filtered columns can reduce how much data is scanned and improve query performance at the same time. If you have a read-heavy workload (most common), this can be particularly advantageous. Note that writing to columns referenced in an index will add at least one (1) additional write unit to account for updating the index, but this is typically offset by the reduction in read units consumed due to the benefits of an index.

  • Does a freshly created database, and/or an empty table with no rows, contribute to my storage?

Yes, although minimal. An empty table consumes at least a few kilobytes, based on the number of columns (table width) in the table. An empty database consumes approximately 100KB of storage.