Storage size calculations

This page describes the storage size of documents, document names, fields, andindex entries inCloud Firestore.

You can learn about the costs of this storage atCloud FirestorePricing.

String size

String sizes are calculated as the number ofUTF-8 encoded bytes + 1.

The following are stored as strings:

  • Collection IDs
  • String document IDs
  • Document names
  • Field names
  • String field values

For example:

  • The collection IDtasks uses 5 bytes + 1 byte, for a total of 6 bytes.
  • The field namedescription uses 11 bytes + 1 byte, for a total of 12bytes.

Document ID size

The size of a document ID is either thestring size for a stringID or 8 bytes for an integer ID.

Note: TheCloud Firestore client libraries always use string documentIDs.

Document name size

The size of a document name is the sum of:

  • The size of each collection ID and document ID in the path to the document
  • 16 additional bytes

For a document in the subcollectionusers/jeff/tasks with a string document IDofmy_task_id, the document name size is 6 + 5 + 6 + 11 + 16 = 44 bytes:

  • 6 bytes for theusers collection ID
  • 5 bytes for thejeff document ID
  • 6 bytes for thetasks collection ID
  • 11 bytes for themy_task_id document ID
  • 16 additional bytes
Note: Any documents in subcollections under the document, for exampleusers/jeff/tasks/my_task_id/comments/D8PvloqiczrzXik3SWjZ, aren't counted towards the document name size or the 1 MiB limit for theusers/jeff/tasks/my_task_id document.

Field value size

The following table shows the size of field values by type.

TypeSize
ArrayThe sum of the sizes of its values
Boolean1 byte
BytesByte length
Date and time8 bytes
Floating-point number8 bytes
Geographical point16 bytes
Integer8 bytes
MapThe size of the map, calculated the same way asdocument size
Null1 byte
ReferenceThedocument name size
Text stringNumber of UTF-8 encoded bytes + 1
Vector8 bytes per dimension

For example, a boolean field nameddone would use 6 bytes:

  • 5 bytes for thedone field name
  • 1 byte for the boolean value
Note: Field values in an index are truncated after 1500 bytes, seeindexing limits.

Document size

The size of a document is the sum of:

This example is for a document in subcollectionusers/jeff/taskswith a string document ID ofmy_task_id:

 - "type": "Personal" - "done": false - "priority": 1 - "description": "Learn Cloud Firestore"

The total size of the fields is 71 bytes:

Field name and valueField size in bytes
"type": "Personal"14
5 for the field name + 9 for the field's string value
"done": false6
5 for the field name + 1 for the field's boolean value
"priority": 117
9 for the field name + 8 for the field's integer value
"description": "Learn Cloud Firestore"34
12 for the field name + 22 for the field's string value

So the document size is 44 + 71 + 32 = 147 bytes:

  • 44 bytes for the document name
  • 71 bytes for the fields
  • 32 additional bytes
Note: Any documents in subcollections under the document, for exampleusers/jeff/tasks/my_task_id/comments/D8PvloqiczrzXik3SWjZ, aren't counted towards the document name size or the 1 MiB limit for theusers/jeff/tasks/my_task_id document.

Index entry size

Index entry sizes are calculated as follows for single-field and compositeindexes.

Single-field index entry size

The size of a single-field index entry depends on whether an index is scoped toa collection or a collection group.

Collection scope

The size of an entry in a single-field index with collection scope is the sumof:

Consider a document in the sub-collectionusers/jeff/tasks witha string document ID ofmy_task_id:

 - "type": "Personal" - "done": false - "priority": 1 - "description": "Learn Cloud Firestore"

For a single-field index with collection scope that indexes thedonefield, the total size of the entry in this index is 109 bytes:

  • 44 bytes for the document nameusers/jeff/tasks/my_task_id
  • 27 bytes for the parent document's document nameusers/jeff
  • 5 bytes for thedone field name
  • 1 byte for the boolean field value
  • 32 additional bytes

Collection group scope

The size of an entry in a single-field index with collection group scope is thesum of:

Consider a document in the sub-collectionusers/jeff/tasks witha string document ID ofmy_task_id:

 - "type": "Personal" - "done": false - "priority": 1 - "description": "Learn Cloud Firestore"

For a single-field index with collection group scope that indexes thedonefield, the total size of the entry in this index is 98 bytes:

  • 44 bytes for the document nameusers/jeff/tasks/my_task_id
  • 5 bytes for thedone field name
  • 1 byte for the boolean field value
  • 48 additional bytes

Composite index entry size

The size of an entry in a composite index depends on whether the index is scopedto a collection or a collection group.

Collection scope

The size of an index entry in a composite index with collection scope is thesum of:

Consider a document in the sub-collectionusers/jeff/tasks witha string document ID ofmy_task_id:

 - "type": "Personal" - "done": false - "priority": 1 - "description": "Learn Cloud Firestore"

For a composite index with collection scope that indexes thedone andpriority fields (both ascending), the total size of the entry in this index is112 bytes:

  • 44 bytes for the document nameusers/jeff/tasks/my_task_id
  • 27 bytes for the parent document's document nameusers/jeff
  • 1 byte for the boolean field value
  • 8 bytes for the integer field value
  • 32 additional bytes

Collection group scope

The size of an index entry in a composite index with collection group scope isthe sum of:

Consider a document in the sub-collectionusers/jeff/tasks witha string document ID ofmy_task_id:

 - "type": "Personal" - "done": false - "priority": 1 - "description": "Learn Cloud Firestore"

For a composite index with collection group scope that indexes thedone andpriority fields (both ascending), the total size of the index entry in thisindex is 85 bytes:

  • 44 bytes for the document nameusers/jeff/tasks/my_task_id
  • 1 byte for the boolean field value
  • 8 bytes for the integer field value
  • 32 additional bytes

What's next

Learn aboutCloud Firestore pricing.

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 2026-02-18 UTC.