Naming photos for SEO: the pattern, the rules, and how to rename a library you have already published
A file naming convention that scales to thousands of images, what the filename does that alt text does not, and the safe way to rename images that already have URLs.
Published by AI Knows Us · Updated 10 October 2026
Name an image file for what the picture shows, in lower case, with hyphens between words, in three to six words, and do it at the export step before the file is uploaded. oak-dining-table-six-seater.jpg works. IMG_4471.jpg tells a crawler nothing, and cheap-dining-table-dining-tables-buy-table-online.jpg is worse than the camera name because it reads as manipulation. Getting this right at export is practical: once an image is published it has a URL, and changing the filename later changes that URL, which means a redirect and a period where the old address is still requested. Naming is a ten second habit at export, or an afternoon of cleanup afterwards.
This page covers file naming and the folder path: the convention, applying it at scale, and renaming an existing library safely. For formats, compression, responsive markup, alt text and image sitemaps, see the nine step image checklist.
What the filename is doing
An image carries several separate pieces of description, and they are not interchangeable. Confusing them is why so many sites have keyword stuffed filenames and empty alt attributes.
| Element | Who reads it | Its job |
|---|---|---|
| File name and folder path | Search engines, and anyone who downloads it | Name the subject, and survive being saved to somebody's desktop intact |
| Alt attribute | Screen readers first, search engines second | Describe the image to a person who cannot see it |
| Caption | Readers | Say the thing a reader would want to know about this specific picture |
| Surrounding text and heading | Search engines and readers | Give the image context, which carries more weight than the filename alone |
| Page URL | Everything | The subject of the page the image sits on |
Google's own Google Images documentation asks for descriptive filenames and alt text, and for images placed near the relevant text. The filename is a modest signal on its own and a strong one in combination with a matching heading, caption and alt attribute. Treat it as one of five things that all have to say the same thing.
The naming pattern
Use one pattern across the whole site. The shape that holds up in every sector is subject, then the attribute that distinguishes this image from a near identical one, then the variant.
subject-distinguishing-attribute-variant.ext oak-dining-table-six-seater-front.jpg
oak-dining-table-six-seater-detail-joint.jpg
victorian-terrace-didsbury-kitchen.jpg
chocolate-babka-sliced-crumb.jpg
dr-anita-rao-consultation-room.jpg The rules that make the pattern work:
- Lower case throughout. Some servers treat
Table.jpgandtable.jpgas different files and some do not, and that difference becomes a broken image at the worst possible moment. - Hyphens between words, never underscores or spaces. A space becomes
%20in the URL, which is ugly and easy to break. Hyphens are read as word separators. - Plain ASCII only. No accented characters, no ampersands, no commas, no brackets, no plus signs. If the subject has an accent in its name, transliterate it in the filename and keep the accent in the caption and alt text where a reader sees it.
- Three to six words, and under about sixty characters. Long enough to be specific, short enough to read in a URL bar and in a download folder.
- One accurate phrase, not a list of keywords. Stacking phrases into a filename is the one version of this that can actively work against you.
- Unique across the site. Two files called
hero.jpgin different folders is a maintenance problem waiting to happen. Make the name self explanatory out of context. - No dates unless the date is part of the subject. An event photo can carry the year. A product photo should not, because the file outlives the shoot.
Good and bad, by sector
| Sector | Weak | Better |
|---|---|---|
| Ecommerce product | DSC_0188.jpg | merino-crew-jumper-charcoal-front.jpg |
| Property | photo-12-final-v2.jpg | three-bed-semi-chorlton-rear-garden.jpg |
| Recipe | food1.jpg | lamb-rogan-josh-served-with-rice.jpg |
| Portfolio or case study | client-work-3.jpg | bakery-shopfront-signage-installed.jpg |
| Team and clinic | staff_photo_FINAL.jpg | priya-shah-physiotherapist-portrait.jpg |
| Diagram or screenshot | Screenshot 2024-06-12 at 11.30.45.png | search-console-performance-report-filters.png |
Naming a product catalogue at scale
Manual naming stops working somewhere around a few hundred images. For a catalogue, derive the name from data you already hold, in a fixed order, and generate it.
- Start from the product slug you already use for the page URL. It is already descriptive, already unique and already lower case with hyphens.
- Add the variant attribute that changes between images of the same product: colour, size, finish.
- Add the shot type last, from a closed list you decide once:
front,back,side,detail,in-use,scale,packaging,swatch. A fixed vocabulary here is what makes the library searchable for your own team two years later. - Put the SKU at the end if you need it, not at the front.
merino-crew-jumper-charcoal-front-mcj114.jpgstays human readable and still joins back to your product data. - Use the folder path for the category.
/images/knitwear/jumpers/keeps the filenames shorter and gives the path a subject of its own.
// generate image names from a product export, before upload
// node rename.js products.csv ./shoot ./renamed
const fs = require('fs');
const path = require('path');
const [csv, src, dest] = process.argv.slice(2);
const SHOTS = ['front', 'back', 'side', 'detail', 'in-use', 'scale']; const slugify = s => s.toLowerCase() .normalize('NFKD').replace(/[^\x00-\x7f]/g, '') .replace(/[^a-z0-9]+/g, '-') .replace(/^-+|-+$/g, '') .split('-').slice(0, 6).join('-'); fs.mkdirSync(dest, { recursive: true });
for (const line of fs.readFileSync(csv, 'utf8').split(/\r?\n/).slice(1)) { if (!line.trim()) continue; const [file, product, variant, shot] = line.split(','); if (!SHOTS.includes(shot)) { console.log('unknown shot type: ' + line); continue; } const ext = path.extname(file).toLowerCase().replace('.jpeg', '.jpg'); const name = [slugify(product), slugify(variant), shot].filter(Boolean).join('-') + ext; const out = path.join(dest, name); if (fs.existsSync(out)) { console.log('would overwrite, skipped: ' + name); continue; } fs.copyFileSync(path.join(src, file), out); console.log(name);
} Renaming images that are already live
This is where people get hurt, so decide per image rather than renaming everything.
- Check whether the image earns anything first. In Search Console, switch the Performance report to the Google Images search type. Images with impressions and clicks are assets, and their URLs are worth redirecting properly.
- If it earns nothing, rename freely. Upload the renamed file, update every reference including the structured data and the sitemap, and remove the old file.
- If it earns traffic, redirect. Serve a 301 from the old image URL to the new one, keep it in place, and update the sitemap. Check your server logs a fortnight later for requests still hitting the old path, because other sites may be hotlinking it.
- If it is used on other sites, think twice. A reverse image search tells you whether anyone else is embedding or crediting the file, and a rename breaks those.
- Know what your platform will let you do. Some content management systems store the uploaded filename and offer no rename, so the route is to upload a correctly named copy, repoint the references, redirect, then delete. Some hosted storefronts assign their own filename on upload. Check this before planning a bulk rename, because the platform decides the method.
A ten second quality check
Run this in the browser console on any page to list every image and the name it is serving, which makes bad names obvious at a glance.
[...document.images].map(i => ({ file: i.currentSrc.split('/').pop().split('?')[0], alt: i.alt || '(empty)', shown: i.width + 'x' + i.height
})) Three faults to look for: camera and screenshot defaults, numbered sequences with no subject, and one name repeated with a counter on the end.
Does the image file name affect rankings?
It is one of several signals that describe an image, and it works together with the alt attribute, the caption, the nearby text and the heading above it. Expect it to help most for image search and for pages where the picture is the point, such as products, property, recipes and portfolios. Treat it as a cheap, permanent improvement rather than a lever on its own.
Should keywords go in the filename?
The accurate description of the picture is the keyword, and that is as far as it goes. One phrase that says what the image shows, in natural word order. Repeating phrases or appending a city and a price to every file reads as manipulation and makes the library unusable for your own team.
Hyphens or underscores?
Hyphens. They are read as word separators in a URL. Underscores join words together, which defeats the purpose of naming the file at all. Keep the whole name to three to six words and under about sixty characters.
What about the folder path?
Use it. A path like /images/products/dining-tables/ carries category meaning, keeps filenames shorter and makes bulk work far easier. Avoid dated folders such as /2019/07/ for evergreen assets, because the date becomes misleading the first time you update the picture.
Do I need to rename my whole existing library?
No. Rename new uploads from today, rename the images on your most important pages, and leave the rest. The compounding value is in the habit at the export step, not in a retrospective sweep.
Where image naming is now doing a second job
ChatGPT, Gemini, Perplexity, Claude and Google's AI Overviews read pages to assemble short answers and name a few companies in reply to a buyer's question, and the descriptive text around an image, including the filename, the caption and the alt attribute, is part of how they work out what a page is about. A gallery of files called IMG_4471.jpg with empty alt attributes describes itself less clearly to every reader it has. Test what those answers currently say about you: ask your main buying questions in two or three assistants, leave your own brand name out of the prompt so the answer is not steered, and note which of your pages are cited. AI Knows Us runs that check across the five assistants and shows which sources each answer was built from, with no account needed for a first scan.