Characters to Avoid in Filenames and Directories

Your web files will be viewed by numerous users who use a wide variety of operating systems (Mac, PC, and Linux for instance) and devices (desktops, tablets, and smartphones are some examples). Therefore, it is essential to play it safe and avoid common illegal filename and directory characters.

Naming conventions are important in web folders as well as for downloadable files such as HTML files, images, PDFs, Word documents, and Excel spreadsheets.

Illegal Filename Characters

Do not use any of these common illegal characters or symbols in your filenames or folders:

# pound

% percent

& ampersand

{ left curly bracket

} right curly bracket

\ back slash

< left angle bracket

> right angle bracket

* asterisk

? question mark

/ forward slash

  blank spaces

$ dollar sign

! exclamation point

' single quotes

" double quotes

: colon

@ at sign

+ plus sign

` backtick

| pipe

= equal sign

Also, keep these rules in mind.

  • Don’t start or end your filename with a space, period, hyphen, or underline.
  • Keep your filenames to a reasonable length and be sure they are under 31 characters.
  • Most operating systems are case sensitive; always use lowercase.
  • Avoid using spaces and underscores; use a hyphen instead. This will also improve your search engine rankings.


Bad filenames:

  • F&A Costs.html
  • my PDF file#name.pdf

Web browsers see:

  • F&amp;A%20Costs.html
  • my%20PDF%20file%23name.pdf

Good filenames:

  • index.html
  • my-pdf-file-name.pdf

Note: This list is not exhaustive. It is meant to help you avoid common errors in filenames. If you have any questions or need any assistance, do not hesitate to contact