Which is correct: "Filename", "File Name" or "FileName"?

  • 2
    Or "File-name"?
    – Gnubie
    Commented Apr 2, 2013 at 19:07
  • 2
    I like the look of filename, however, when you end up talking about other attributes of that file, which happens in programming a lot, for example, it is often much better to use file name instead. This way you can do file name, file size, file format, etc. without losing the symmetry, as you would with filename, file size, file format, etc. Commented Jan 8, 2019 at 5:41
  • Of note, the Content-Disposition header in web requests accepts a value of filename="file.txt", indicating that they have standardized on the use of filename as opposed to file_name. Commented Jan 8, 2019 at 5:45

7 Answers 7


The original form of the word was "file name", as in the name of a file. These days (and probably for a good few years), the compound "filename" is widely accepted and perhaps most commonly used. Either is of course perfectly acceptable.

Do not, however, capitalise letters in the middle of a word, under any circumstances. (Unless you are writing variable names in code.)

  • 17
    Similarly, don't use "File Name". There is no reason "Name" should ever be capitalized in the middle of a sentence. (Unless, I suppose, someone is named "Name", but that takes pedantry to new extremes.)
    – res
    Commented Nov 22, 2010 at 14:37
  • 1
    I have never known "filename" to be a widely used closed-form compound term; there are, indeed, many instances of it around (particularly in code), but that doesn't necessarily make it correct. A generic term could be used which makes the use of either word redundant, and that is "path" - this applies to both files and directories, since both are simply file system objects. Commented Aug 1, 2011 at 14:58
  • 6
    It might also be worth mentioning that Microsoft themselves don't consider "filename" appropriate in their Design Guidelines for Developers - so, they're not an authority on English language, but they do set standards in a vast amount of computing arenas (particularly worth heeding if this is programming related.) Commented Aug 1, 2011 at 15:05
  • 1
    I agree with Microsoft here, yeah. Funnily enough I've noticed they don't always follow this rule in their APIs, but mostly, they do.
    – Noldorin
    Commented Aug 2, 2011 at 8:13
  • 1
    @aamos: I mean in words that would normally not have their letters capitalised; non-proper nouns, of course.
    – Noldorin
    Commented Feb 5, 2013 at 18:14

Filename is in my experience the most common and in my opinion the best looking. File name is also acceptable, but I would only use it rarely, perhaps in a parallel construction such as the file name and size. I find word-medial capital letters distracting and unpleasant anywhere but program source code, so I would never even think of FileName. Edit: if that's the reason you're asking, in program source I would still use Filename for a class or filename for a variable, not FileName nor fileName, respectively.

The British National Corpus has 240 cites for filename and 72 cites for file name. It's not possible to search case-sensitively, but several reloads of the random sample of specific entries gave me no matches for FileName.

  • In the parallel construction example, wouldn't you more correctly say the file's name and size?
    – user4012
    Commented Nov 22, 2013 at 5:35
  • 2
    @LucasTizma: Appositive and possessive both work.
    – Jon Purdy
    Commented Nov 22, 2013 at 19:32
  • Hm, I always use file_name
    – Bono
    Commented Jul 22, 2015 at 6:47
  • @JonPurdy thanks for the variable name clarification
    – johnny 5
    Commented Apr 4, 2018 at 7:39
  • This works great until you also need to refer to a different attribute of the file, say the "size". Then do you do filesize or do you do file size? I would personally prefer keeping the object and the attribute separate so that you can expand on it if necessary: file name, file size, file type, etc. Commented Jun 25, 2020 at 17:04

The AHD has an entry for “filename”, so it is, at least, an established American English word. Thus it is “correct” for some situations.

Update: the word “pathname” is also included in the American Heritage Dictionary: Fifth Edition. So over time I will be changing my program variables from SettingFilePathName to SettingFilePathname.


None of them. "filename" is not a proper noun, and thus should not be capitalized. If you begin a sentence with the word, then it should be "Filename".


Generally, I would say "filename", as that is what I have seen used in most software development textbooks. That's not to say that this is the standard by which all words should be measured, but given that the word is generally used in relation to computers I would imagine that it is safe to use.


Any two words (such as 'file name') used together for long enough periods of time end up with a single meaning in our collective language. When that happens, you can combine the two, though it's not advisable for formal usage. Words such as, for example, 'himself' are older, and common examples from the computer age include 'username', 'email', and 'desktop'.

For formal usage, consider spacing the words or using a hyphen, where appropriate.

  • I somehow do not like “file-name” even in formal context. Both “filename” and “file name” are fine. Commented Nov 23, 2010 at 14:47
  • To clarify: some word combinations use spaces, while others use hyphens. By "where appropriate," I meant that you should use whichever you find appropriate.
    – Michael Kozakewich
    Commented Nov 23, 2010 at 14:52
  • 1
    ‘Email’ should be a completely unacceptable spelling. The ‘e’ is an abbreviation of electronic, thus, the spelling should be e-mail. Allowing the hyphen to magically disappear makes it very inconsistent. What happens, then, to words like e-economy? How about h-bomb, t-bone, and x-ray? Commented Nov 23, 2014 at 23:25
  • @FrederikKrautwald late to the party, but it's an internet thing, and totally different from how we got h-bomb/t-bone/x-ray, so those would probably never undergo that process. I've never once seen 'e-economy' but I suspect 'digital economy' is better anyway.
    – sleighty
    Commented Dec 10, 2021 at 18:05
  • I am only here to comment on @Federik Krautwald's comment to say that "email" has been the correct spelling for a long time now. If you use "e-mail" you will really be dating yourself to say the least, and you might as well call the internet the "information super highway." grammarly.com/blog/spelling-e-mail-email/….
    – ghbarratt
    Commented Jan 28, 2022 at 16:01

The OED has no entry for "filename." However, being a technical writer of 25 years, I have adopted this spelling because programmers and engineers prefer it. Still, it seems odd to me.


Not the answer you're looking for? Browse other questions tagged or ask your own question.