CodesCompiler
🔍
HTMLCSSJavaScriptPythonSQLPHPSEOPostsBooksKids About Contact 🚀 Get Started Free

SEO-Friendly File Names

SEO-Friendly File Names

A filename is the name assigned to a file, such as an image, PDF, or downloadable document. Descriptive filenames help people manage assets and can provide search engines with context about a file. They are only one small part of SEO; a filename alone cannot make a weak page rank well.

Compare these two image names:

  • IMG_8472.webp
  • blue-ceramic-coffee-mug.webp

If the image shows a blue ceramic coffee mug, the second name is easier to recognize in a media library and describes the subject more clearly.

How to name files

Use a few practical rules:

  1. Describe the actual content, not the keyword you wish the page to rank for.
  2. Keep the name reasonably short and specific.
  3. Separate words with hyphens when that improves readability.
  4. Use lowercase consistently to make file management easier.
  5. Avoid unnecessary dates, random strings, and repeated keywords.
  6. Keep the file extension accurate to the file format.

For example, python-list-example.png is more useful than best-python-python-list-python-example-final2.png if the image illustrates a Python list.

Filename, alt text, and surrounding content

These elements serve different purposes:

  • Filename: identifies the file and may provide a little context.
  • Alt text: describes the informative purpose or content of an image for people who cannot see it and for systems that process the page.
  • Caption and nearby text: explain why the image matters in that specific lesson.

Example HTML:

HTML CODE
<img src="/images/python-list-example.png"
     alt="A Python list containing three course names">

The alt text should match the image. If the image is decorative and conveys no information, an empty alt attribute (alt="") may be appropriate. Do not copy the same keyword phrase into the filename, alt text, caption, and every heading without considering whether each description is useful.

File names for downloadable documents

For a PDF tutorial, a name such as beginner-seo-checklist.pdf tells users more than document-final-new.pdf. Keep the name accurate if the document changes, and avoid renaming a file already linked from many pages unless you can update the links or provide a redirect.

Common mistakes

  • Using a misleading name that does not describe the image.
  • Treating keywords in filenames as a guaranteed ranking technique.
  • Repeating keywords unnaturally.
  • Forgetting to update references after moving or renaming a file.
  • Using alt text to stuff keywords instead of describing the image.

For more context, review on-page SEO techniques and SEO design and layout.