Loading…

IndexedDB Playground

IndexedDB is a real database built into every modern browser. This playground gives you your own IndexedDB database so you can add records, read them back and query them with simple commands.

It is the best way to understand what IndexedDB stores, how records are found by key, and how an index makes searching by another field possible.

Things to try

  • Add a few records with PUT, using JSON objects that have an id.
  • Read one record back with GET and its id.
  • Find records by category with QUERY category=outdoor.
  • See everything in the store with LIST.
  • Remove a record with DELETE, or empty the store with CLEAR.

How it works

Each playground opens its own real IndexedDB database with one object store called "items" (records are keyed by their id field) and one index on the "category" field.

Your commands use the real IndexedDB API and real transactions. The database belongs only to this playground, so it never mixes with any other data on the site.

Frequently asked questions

What is IndexedDB used for?

Websites use IndexedDB to store larger amounts of structured data in the browser, for example offline data, cached records or drafts.

How is IndexedDB different from localStorage?

localStorage stores simple text values. IndexedDB stores whole objects, supports indexes for searching, and can hold much more data.

What does the index do in this playground?

The index on category lets QUERY find every record with a given category directly, without reading each record one by one.