The delete() method of the IDBObjectStore interface returns an IDBRequest object, and, in a separate thread, deletes the specified record or records.

Either a key or an IDBKeyRange can be passed, allowing one or multiple records to be deleted from a store. To delete all records in a store, use  IDBObjectStore.clear.

Note: This feature is available in Web Workers.


var request = objectStore.delete(keyorKeyRange);

Return value

An IDBRequest object on which subsequent events related to this operation are fired. The request.result attribute is set to undefined.


This method may raise a DOMException of the following types:

Exception Description
TransactionInactiveError This IDBCursor's transaction is inactive.
ReadOnlyError The transaction mode is read-only.
InvalidStateError The cursor was created using IDBindex.openKeyCursor, is currently being iterated, or has iterated past its end.
DataError The key is not a valid key or a key range


In the following code snippet, we open a read/write transaction on our database and delete one specific record out of our object store using delete() — a sample record with the key "Walk dog". For a full working example, see our To-do Notifications app (view example live.)

// Let us open our database
var DBOpenRequest ="toDoList", 4);

DBOpenRequest.onsuccess = function(event) {
  note.innerHTML += '<li>Database initialised.</li>';
  // store the result of opening the database in the db variable. This is used a lot below
  db = DBOpenRequest.result;
  // Run the deleteData() function to delete a record from the database

function deleteData() {
  // open a read/write db transaction, ready for deleting the data
  var transaction = db.transaction(["toDoList"], "readwrite");

  // report on the success of opening the transaction
  transaction.oncomplete = function(event) {
    note.innerHTML += '<li>Transaction completed: database modification finished.</li>';

  transaction.onerror = function(event) {
    note.innerHTML += '<li>Transaction not opened due to error: ' + transaction.error + '</li>';

  // create an object store on the transaction
  var objectStore = transaction.objectStore("toDoList");

  // Delete the specified record out of the object store
  var objectStoreRequest = objectStore.delete("Walk dog");

  objectStoreRequest.onsuccess = function(event) {
    // report the success of our delete operation
    note.innerHTML += '<li>Record deleted.</li>';


The key of the record to be deleted, or an IDBKeyRange to delete all records with keys in range.


Specification Status Comment
Indexed Database API
The definition of 'delete()' in that specification.

Browser compatibility

Feature Chrome Edge Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 23webkit
24 (unprefixed)
(Yes) 10 moz
16.0 (16.0)
10, partial 15 7.1
Available in workers (Yes) ? 37.0 (37.0) ? (Yes) ?
Feature Android Android Webview Edge Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile Chrome for Android
Basic support 4.4 (Yes) (Yes) 22.0 (22.0) 1.0.1 10 22 8 (Yes)
Available in workers (Yes) (Yes) ? 37.0 (37.0) (Yes) ? (Yes) ? (Yes)

See also

Document Tags and Contributors

 Contributors to this page: libbymc, jpmedley, inexorabletash, chrisdavidmills, fscholz
 Last updated by: libbymc,