Hide Photos from Gallery Apps on Android

Last Updated :

To hide photos from your gallery app without deleting them, place a .nomedia file in the folder that contains those photos. Android's media scanner will skip the entire folder, making its contents invisible to Google Photos, Samsung Gallery, and every other media-browsing app — while the actual files remain untouched and fully accessible through file managers like AnExplorer.

Android maintains a system-wide media database called MediaStore. Whenever files change on your device, the media scanner crawls storage directories and indexes every image, video, and audio file it finds. Gallery apps read from this index rather than scanning the filesystem themselves. This means:

  • Every photo in DCIM/, Pictures/, Download/, and similar folders gets indexed automatically
  • Screenshots, app-saved images, memes, work documents with image previews — everything appears in your gallery
  • You cannot selectively exclude files from the gallery through the gallery app itself (most galleries lack this feature)

The solution is controlling what the media scanner indexes, not what the gallery displays.

Method 1: The .nomedia File (Best for Folders)

The .nomedia file is an empty marker file recognized by Android's media scanner. When the scanner encounters a folder containing a .nomedia file, it skips the entire folder and all subfolders within it. No images, videos, or audio files from that directory tree will appear in any media app.

Creating a .nomedia File with AnExplorer

  1. Open AnExplorer and navigate to the folder containing photos you want hidden
  2. Tap ⋮ (Menu)NewFile
  3. Name the file: .nomedia (the leading dot is mandatory)
  4. The file content does not matter — it can be empty (0 bytes)
  5. Tap Create or OK

If your device shows an error for filenames starting with a dot:

  1. Create a file named nomedia (without the dot)
  2. Long-press the file → Rename
  3. Change the name to .nomedia

Verifying It Works

After creating the .nomedia file:

  1. Force-close your gallery app: Settings → Apps → Gallery App → Force Stop
  2. Reopen the gallery app
  3. The photos from that folder should no longer appear
  4. If they still show, clear the gallery app's cache: Settings → Apps → Gallery App → Storage → Clear Cache
  5. As a last resort, reboot your phone to trigger a full media re-scan

The photos are still physically present — open AnExplorer and navigate to the folder to confirm they are unchanged.

Get the AnExplorer File Manager

Manage, transfer, and access your files on any device.

Get the App

Method 2: Move Photos to a Hidden Folder

Instead of adding .nomedia to an existing folder, create a dedicated hidden folder for private photos:

  1. Open AnExplorer → navigate to Internal Storage
  2. Create a new folder named .private or .hidden_photos (starting with a dot)
  3. The dot prefix makes the folder itself hidden from casual browsing
  4. Create a .nomedia file inside this folder (for double protection)
  5. Move your private photos into this folder using AnExplorer's move function

This gives you two layers of privacy:

  • The folder is hidden (invisible without "Show Hidden Files" enabled)
  • The .nomedia file prevents media indexing even if someone enables hidden files

Organizing Hidden Photos

Create subfolders within your hidden directory to stay organized:

.private/
├── .nomedia
├── personal/
├── documents/
└── screenshots/

The .nomedia file in the parent folder cascades to all subfolders, so you only need one.

Method 3: Rename Files with Dot Prefix

For individual files rather than entire folders, you can hide specific photos by renaming them with a dot prefix:

  1. Open AnExplorer → navigate to the photo
  2. Long-press → Rename
  3. Change photo.jpg to .photo.jpg
  4. The file is now hidden from media scanning AND from file manager browsing (unless Show Hidden Files is enabled)

This method is tedious for many files but precise for hiding specific images without moving them.

Method 4: Use Android's Built-in Secure Folder (Samsung)

Samsung devices include a Secure Folder feature powered by Knox:

  1. Open Settings → Biometrics and security → Secure Folder
  2. Sign in with your Samsung account and set a PIN/pattern/biometric
  3. Open Secure Folder → tap Add filesImages
  4. Select photos to move into the encrypted container
  5. Choose Move (not Copy) to remove them from the regular gallery entirely

Secure Folder stores files in an encrypted partition that requires authentication to access. This is more secure than .nomedia because the files are actually encrypted, not just hidden from indexing.

Get the AnExplorer File Manager

Manage, transfer, and access your files on any device.

Get the App

Limitations of Secure Folder

  • Samsung only (not available on Pixel, OnePlus, Xiaomi, etc.)
  • Files inside cannot be accessed by any file manager including AnExplorer (by design)
  • If you forget your PIN and Samsung account password, files are permanently inaccessible
  • Factory reset destroys Secure Folder contents

Method 5: Google Photos Locked Folder (Pixel and Others)

Google Photos includes a Locked Folder feature on Pixel devices and many others:

  1. Open Google PhotosLibraryUtilitiesLocked Folder
  2. Set up with your screen lock (PIN/pattern/fingerprint)
  3. Move photos into the Locked Folder
  4. These photos are removed from the main gallery, not backed up to cloud, and require authentication to view

This is convenient but limited:

  • Photos in Locked Folder are NOT backed up (risky if phone is lost)
  • Cannot be accessed from file managers
  • Only works within Google Photos itself

Comparing All Methods

MethodSecurity LevelEase of UseWorks System-WideRecoverable
.nomedia fileLow (hides from gallery only)EasyYesYes — delete the .nomedia file
Hidden folder (.dot prefix)Low-MediumEasyYesYes — enable hidden files
File rename (.prefix)LowTediousYesYes — rename back
Samsung Secure FolderHigh (encrypted)MediumSamsung onlyOnly with Samsung account
Google Locked FolderMediumEasyGoogle Photos onlyOnly with screen lock

Important Warnings

.nomedia Does NOT Provide Security

The .nomedia file only controls media indexing — it does not encrypt, lock, or protect files in any way. Anyone who opens a file manager and enables "Show Hidden Files" can see everything. For actual security:

  • Use encrypted archives (ZIP with password via AnExplorer)
  • Use Samsung Secure Folder or similar encrypted containers
  • Use AnExplorer's file encryption feature if available

Get the AnExplorer File Manager

Manage, transfer, and access your files on any device.

Get the App

Cloud Backup Complications

If you use Google Photos auto-backup:

  • Photos backed up BEFORE adding .nomedia remain in the cloud
  • Adding .nomedia prevents FUTURE backups from that folder
  • To fully hide photos from cloud, delete them from Google Photos web (photos.google.com) after adding .nomedia locally
  • Google Photos Locked Folder explicitly does not sync to cloud

After adding .nomedia, photos may still appear in your gallery temporarily because:

  • Gallery apps cache thumbnails and metadata
  • The media scanner runs periodically, not instantly
  • Force-stopping the gallery and clearing its cache speeds up the process
  • A full device reboot guarantees a fresh media scan

Troubleshooting

  1. Confirm the file is named exactly .nomedia (not .nomedia.txt or nomedia)
  2. Confirm it is in the correct folder (same directory as the photos, not a subfolder)
  3. Force-stop the gallery app and clear its cache
  4. Reboot the phone
  5. If using Google Photos, check that you are not seeing cloud-synced copies

.nomedia file keeps disappearing

Some apps (particularly those that write media to folders) delete .nomedia files they find. WhatsApp, for example, may recreate its media folders without the .nomedia file after updates. Solutions:

  • Make the .nomedia file read-only (requires root or ADB)
  • Move private photos to your own folder structure instead of modifying app folders
  • Check periodically if the .nomedia file is still present

Cannot create a file starting with dot

Some Android versions or launchers restrict dot-prefix filenames in certain creation dialogs. Use AnExplorer's file creation which supports dot-prefixed names, or create the file without the dot and rename it afterward.

Get the AnExplorer File Manager

Manage, transfer, and access your files on any device.

Get the App

Frequently Asked Questions

Copyright © DWorkS 2011 – 2026 All Rights Reserved.