Choose a Database: Cloud Firestore or Realtime Database Stay organized with collections Save and categorize content based on your preferences.
Firebase offers two cloud-based, client-accessible document databases. Werecommend new customers start withCloud Firestore:
Cloud Firestore is therecommended enterprise-grade JSON-compatibledocument database, trusted by more than 600,000 developers. It's suitable forapplications with rich data models requiring queryability, scalability, andhigh availability. It also offers low latency client synchronization and offlinedata access.
Realtime Database is the classic Firebase JSON database. It's suitable forapplications with simple data models requiring simple lookups and low-latencysynchronization with limited scalability.
What are some other important things to consider?
After thinking about the previous key considerations, you might be ready tochoose a database.If you're still weighing advantages and disadvantages, this section covers otherdifferences betweenCloud Firestore andRealtime Database.
Data model
BothRealtime Database andCloud Firestore are NoSQL Databases.
| Cloud Firestore | [ PREFERRED ] | Realtime Database |
|---|---|---|
Stores data as collections of documents.
Learn more about theCloud Firestore data model. | Stores data as one large JSON tree.
Learn more about theRealtime Database data model. | |
Realtime and offline support
Both have mobile-first, realtime SDKs and both support local data storage foroffline-ready apps.
| Cloud Firestore | [ PREFERRED ] | Realtime Database |
|---|---|---|
| Offline support for Apple, Android, and web clients. | Offline support for Apple and Android clients. | |
Presence
It can be useful to know when a client is online or offline. FirebaseRealtime Database can record client connection status and provide updatesevery time the client's connection state changes.
| Cloud Firestore | [ PREFERRED ] | Realtime Database |
|---|---|---|
| Not supported natively. You can build onRealtime Database's support for presence by syncingCloud Firestore andRealtime Database usingCloud Functions SeeBuild presence inCloud Firestore. | Presence supported. | |
Querying
Retrieve, sort, and filter data from either database through queries.
| Cloud Firestore | [ PREFERRED ] | Realtime Database |
|---|---|---|
Indexed queries with compoundsorting and filtering.
| Deep queries with limitedsorting and filtering features.
| |
Writes and transactions
| Cloud Firestore | [ PREFERRED ] | Realtime Database |
|---|---|---|
Advanced write and transaction operations.
| Basic write and transaction operations.
| |
Reliability and performance
| Cloud Firestore | [ PREFERRED ] | Realtime Database |
|---|---|---|
Cloud Firestore is aregional and multi-region solution that scales automatically.
| Realtime Database is aregional solution.
| |
Uptime
| Cloud Firestore | [ PREFERRED ] | Realtime Database |
|---|---|---|
Extremely high uptime performance.
| High uptime performance.
| |
Scalability
| Cloud Firestore | [ PREFERRED ] | Realtime Database |
|---|---|---|
Scaling is automatic.
| Scaling requires sharding.
| |
Security
| Cloud Firestore | [ PREFERRED ] | Realtime Database |
|---|---|---|
Non-cascading rules that combine authorization and validation.
| Cascading rules language that separates authorization and validation.
| |
Pricing
Both solutions are available on theSpark and Blaze pricing plans.
| Cloud Firestore | [ PREFERRED ] | Realtime Database |
|---|---|---|
| Charges primarily onoperations performed in your database(read, write, delete) and, at a lower rate, bandwidth and storage. Cloud Firestore supports monthlybudgets and alertsto avoid spending more than you are comfortable with. Read more aboutCloud Firestore pricing plans. | Charges only forbandwidth and storage, but at a higherrate. Read more aboutRealtime Database pricing plans. | |
UsingCloud Firestore andRealtime Database
You can use both databases within the same Firebase app or project. Both NoSQLdatabases can store the same types of data and the client libraries work in asimilar manner. Keep in mind the differences outlined previously if you decidetouse both databases in your app.
Learn more about the features available in bothRealtime DatabaseandCloud Firestore.
Ready to choose a database?
Hopefully this comparison has helped you settle on a Firebase database solution.Now you can learn how to add a database to your Firebase projects.
- ForCloud Firestore, take a look atGet started with Cloud Firestore.
- ForRealtime Database, read the Get Started topic for your platform:Apple,Android,C++,Unity,Web, orREST.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-12-05 UTC.