Counting Layers In Photoshop

Have you ever wanted to know how many layers are currently in your .pdf/.psd file? Simple, the answer is 3, or 8 or even 17. I’m not talking about simple files like this one.


Three layered .psd in photoshop


Ok, so clearly you can work that one out for yourself…. theirs three layers in that file. How about this file?



So this image is a bit more of a strain to count, it would probably take five, maybe ten minutes to count the layers. Theirs only 45 layers but this can all take time if you have to count them yourself. What if your images start to get really big (not filesize) but regards layers. Do you really have the time to count hundreds of layers? Would you have the patience?

The following will help you get around this!
Photoshop Layer counting script – This script will count all the layers for you automatically!


So I’m sure you want to know how to use this?
It’s simple!!

  • Right-click the above link and download the script to your desktop
    (or somewhere you will remember)
  • Open up Photoshop with the file you wish to count
  • Click on ‘File’
  • Then ‘Scripts’
  • Now click ‘Browse’
  • Find the script you just downloaded to your desktop and click Load
  • You will now be prompted with ‘Go through your file and count all the layers??
  • Click ‘Yes’
  • You will now be informed of the amount of layers in your file!

Job done, that was a lot quicker than counting 20-5,000+ layers now wasn’t it?


I hope this script speeds up your photoshopping someday 🙂



This script is used at your own risk, I have personally used it many times but shall not be held responsible for any misbehaviour caused by it!



  • I have no real need to actually count my layers, but i the inner geek just needs to know.. LOVE this script!!! Thank you so much!

  • Andy Vee

    Very interesting script. Took 32s to count 332 layers of my file, a 230MB file. But there is some undocumented features hidden in here. When the dialog shows up asking if I want to “Go through your file and count all the layers??”, if I click ^Yes^, which is the obvious answer (why would I say No? :-)), it will use the recursive method (very neat, by the way) and this method is the one that takes 32 seconds to count all 332 layers (groups included). But, and here is the thing, if I click “No” to that dialog, it will NOT not count (= it WILL count) the layers but instead it will count them anyway but using a probably newer version of the routine (that even allows you to exclude the background layer and the groups from the total count) and this routine takes only one or two seconds to come up with the same answer! Awesome!!

    The problem with the first method, that takes a long time to count the layers in heavy files, is that, to add a progress bar, you would need to know first how many layers you have to feed the progress bar, which is catch-22 situation. Then, you can now use the 2nd method to get the total number of layers quickly and then use the result for the progress bar of the 1st method… hahaha… that would be funny!

    Great code, mate, congrats.

  • 6 years after you published this, it has just helped someone!

    Thanks! 😀

  • Hi people! Here’s my version of this mega-useful script 🙂
    var totalProgress = 0
    var laySets = 0
    function layerCounter(inObj)
    laySets += inObj.layerSets.length
    totalProgress += inObj.artLayers.length
    for (var i=0; i < inObj.layerSets.length; i++) {
    return totalProgress – laySets

    function main() {
    alert("Layer count = " + layerCounter(app.activeDocument) + "\nGroups Count = " + laySets)


  • minor update. now it’s showing total and visible layers too:
    var totalLayers = 0
    var laySets = 0
    var visibleLayers = 0

    function layerCounter(inObj)
    laySets += inObj.layerSets.length
    totalLayers += inObj.artLayers.length

    for (var a=0; a < inObj.artLayers.length; a++) {
    if (inObj.artLayers[a].visible) visibleLayers++

    for (var i=0; i < inObj.layerSets.length; i++) {
    return totalLayers – laySets

    function main() {
    alert("Total Layers = " + layerCounter(app.activeDocument) +
    "\nVisible Layers = " + visibleLayers +
    "\nGroups Count = " + laySets)


  • Sara

    thank you! fast and easy. 6 years later, the same technique is used. 742 layers. Saved me a lot of time 😀

  • Bobby Wain

    this was a tremendous help! 780 layers total! would have hated counting that;-p

  • marko beveli

    how to find tif files which have layers and move them to subfolder?
    or how to copy all layers name and copy it to keywords metadata?


  • Thanks. Still works on Photoshop CC 2014 (2015)

Success, your comment is awaiting moderation.