Skip to content

shtse8/Google-Photos-Delete-Tool

Β 
Β 

Repository files navigation

πŸ—‘οΈ Google Photos Delete Tool

CI Release License: MIT TypeScript Chrome Web Store

The fastest way to bulk delete your Google Photos β€” up to 25Γ— faster than manual deletion.

Google Photos doesn't provide a "delete all" button. This tool automates the tedious process of selecting and deleting photos in batches, so you can reclaim your storage in minutes instead of hours.


✨ Features

  • πŸš€ Batch Deletion β€” Selects and deletes photos in large batches automatically
  • ⏸️ Pause / Resume / Stop β€” Full three-state control over the deletion process
  • πŸ§ͺ Dry Run Mode β€” Count your photos without deleting anything
  • πŸ“Š Live Stats Dashboard β€” Deletion count, rate per minute, elapsed time, and ETA
  • πŸŒ— Auto Dark / Light Mode β€” Adapts to your system preference
  • πŸ”„ Resilient Selectors β€” Fallback selectors when Google updates their UI
  • πŸ“ˆ Smart Rate Tracking β€” Sliding window rate calculation for accurate ETAs
  • πŸ” Exponential Backoff β€” Intelligent retry logic for reliability
  • 🧩 Multiple Formats β€” Chrome extension, userscript, bookmarklet, or console paste

πŸ“Έ Screenshot

Coming soon β€” see docs/screenshot.png

πŸ“¦ Installation

Chrome Extension (Recommended)

  1. Install from the Chrome Web Store
  2. Navigate to photos.google.com
  3. Click the extension icon and press Start

Manual Install (Developer Mode)

  1. Download the latest google-photos-delete-tool.zip from Releases
  2. Go to chrome://extensions/
  3. Enable Developer mode (top-right toggle)
  4. Click Load unpacked and select the extracted folder
  5. Navigate to photos.google.com

Userscript (Tampermonkey / Violentmonkey)

  1. Install Tampermonkey or Violentmonkey
  2. Download the latest google-photos-delete.user.js
  3. Navigate to photos.google.com β€” a floating panel will appear

Bookmarklet

  1. Download bookmarklet.txt from Releases
  2. Create a new bookmark in your browser
  3. Paste the content as the bookmark URL
  4. Navigate to photos.google.com and click the bookmark

Console (DevTools)

  1. Navigate to photos.google.com
  2. Open DevTools (F12 or Ctrl+Shift+J)
  3. Copy the contents of inject.js and paste into the console
  4. Control with: __gpdt_pause(), __gpdt_resume(), __gpdt_stop()

πŸš€ Usage

Chrome Extension

  1. Go to photos.google.com
  2. Click the πŸ—‘οΈ extension icon in your toolbar
  3. Configure options:
    • Max photos β€” How many photos to delete (default: 10,000)
    • Dry run β€” Toggle to count photos without deleting
  4. Click β–Ά Start
  5. Watch the live stats: deletion count, rate, elapsed time, ETA
  6. Use ⏸ Pause, β–Ά Resume, or ⏹ Stop as needed

Userscript / Bookmarklet / Console

A floating panel or console output provides the same controls and stats.

βš™οΈ Configuration

Option Type Default Description
maxCount number 10,000 Maximum photos to delete per run
dryRun boolean false Count photos without deleting
timeout number 600,000 Timeout for DOM operations (ms)
pollDelay number 300 Delay between DOM polls (ms)

πŸ—οΈ Development

Prerequisites

  • Bun (package manager and runtime)
  • Node.js 18+ (for TypeScript tooling)

Setup

git clone https://github.com/shtse8/Google-Photos-Delete-Tool.git
cd Google-Photos-Delete-Tool
bun install

Commands

bun run build       # Build all targets
bun run typecheck   # TypeScript type checking
bun run lint        # ESLint
bun run test        # Run tests (Vitest)
bun run test:watch  # Run tests in watch mode
bun run dev         # Build with watch mode
bun run zip         # Create extension ZIP for upload

Build Targets

Target Output Description
Chrome Extension dist/extension/ MV3 extension with popup, content script, background worker
Standalone dist/standalone/inject.js Paste into DevTools console
Userscript dist/userscript/*.user.js Tampermonkey / Violentmonkey
Bookmarklet dist/bookmarklet.txt javascript: URL
Bookmarklet HTML dist/bookmarklet.html Draggable install page

Architecture

src/
β”œβ”€β”€ core/                   # Shared engine (framework-agnostic)
β”‚   β”œβ”€β”€ config.ts           # Configuration types and defaults
β”‚   β”œβ”€β”€ delete-engine.ts    # Main deletion engine with EventEmitter
β”‚   β”œβ”€β”€ deletion-log.ts     # Rate tracking and ETA estimation
β”‚   β”œβ”€β”€ event-emitter.ts    # Typed EventEmitter (zero deps)
β”‚   β”œβ”€β”€ selectors.ts        # DOM selectors with fallbacks
β”‚   β”œβ”€β”€ utils.ts            # Sleep, waitUntil, retry, formatters
β”‚   └── index.ts            # Barrel exports
β”œβ”€β”€ extension/              # Chrome extension
β”‚   β”œβ”€β”€ background.ts       # Service worker (badge, icon click)
β”‚   β”œβ”€β”€ content.ts          # Content script (runs DeleteEngine)
β”‚   β”œβ”€β”€ popup/              # Extension popup UI
β”‚   β”‚   β”œβ”€β”€ popup.html
β”‚   β”‚   β”œβ”€β”€ popup.css
β”‚   β”‚   └── popup.ts
β”‚   β”œβ”€β”€ manifest.json       # MV3 manifest
β”‚   └── icons/              # Extension icons
β”œβ”€β”€ standalone/inject.ts    # Console paste script
β”œβ”€β”€ userscript/             # Tampermonkey/Violentmonkey
└── bookmarklet/            # Bookmarklet template

❓ FAQ

Is this safe to use?

Yes. The tool only automates clicks that you would normally do manually β€” selecting photos and clicking "Move to trash". Photos go to your Google Photos trash, where they remain for 60 days before permanent deletion. You can restore them anytime from trash.

Why do I need this?

Google Photos has no "Select All" or "Delete All" feature. To delete thousands of photos, you'd need to manually select them in batches of ~500 and delete each batch. This tool automates that process.

What happens if Google updates their UI?

The tool uses resilient selectors with fallbacks. If the primary CSS selector fails, it tries alternative selectors and logs a warning. If all selectors fail, the tool will stop gracefully with an error message.

Can I undo a deletion?

Yes! Deleted photos go to Google Photos trash and stay there for 60 days. Go to photos.google.com/trash to restore them.

How fast is it?

Typically 200–500 photos per minute, depending on your internet speed and Google's rate limiting. That's roughly 25Γ— faster than manual selection and deletion.

Does it work with Google One / shared storage?

Yes. It deletes photos from whatever view you're currently on in Google Photos.

🀝 Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feat/my-feature)
  3. Make your changes
  4. Run bun run typecheck && bun run lint && bun run test && bun run build
  5. Commit with conventional commits (feat:, fix:, refactor:, etc.)
  6. Open a Pull Request

πŸ“„ License

MIT Β© Kyle Tse

πŸ™ Credits

Originally created by mrishab. Forked, modernized, and maintained by Kyle Tse.

About

This tool provides an efficient, stable, and automated way to delete multiple photos from Google Photos. It's now available as a Chrome extension for easier use, but you can also use the script injection method if you prefer. Unlike other scripts or manual methods, this tool offers several unique features.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

No contributors

Languages

  • TypeScript 82.3%
  • CSS 10.3%
  • HTML 7.0%
  • JavaScript 0.4%