In US English, the accepted style is to always put commas or periods inside the closing quotation mark.
This is stated in The Chicago Manual of Style, 6.9 [paywall].
Periods and commas precede closing quotation marks, whether double or single …
He described what he heard as a “short, sharp shock.”
“Thus conscience does make cowards of us all,” she replied.
In UK English, the accepted style is generally—the specific rule is slightly more complex, as demonstrated in the University of Oxford Style Guide [PDF]—to put commas or periods inside the closing quotation mark if that punctuation is part of what's being quoted, otherwise to put them outside.
(It's a common misconception that UK English always has commas and periods go outside closing quotation marks. It's conditional.)
In UK English, therefore, the following is normal:
✔ Provide the password by typing 'password'.
Note the single quotation marks, which is standard in UK English.
But this poses a dilemma in conventional US English:
？ Provide the password by typing "password."
Is the period part of what you need to type, or is it merely punctuation that should not be typed?
Chicago address this specific situation in a couple of ways.
First of all, Chicago, 7.63 [paywall] says this:
When a word or term is not used functionally but is referred to as the word or term itself, it is either italicized or enclosed in quotation marks …
The term critical mass is more often used metaphorically than literally.
What is meant by neurobotics?
If following the style of using italics, the US English version of the sentence would be treated as follows:
Provide the password by typing password.
Since quotation marks are not used, and the period is not in italics, the meaning becomes clearer.
But it might not be clear if the period is actually in italics or not. While we assume that it is not part of the literal password, if it were, and it was in italics, it would be very difficult to distinguish—and using italics would not be a good option in such a specific situation.
To make such a presentation even clearer, Chicago does give a second option.
It says that in specific situations like this, where the US style of punctuation could cause confusion, it's acceptable to use the UK style of punctuation instead.
From Chicago, 6.9 [paywall]:
In an alternative system, sometimes called British style (as described in the New Oxford Style Manual …), single quotation marks are used, and only those punctuation points that appeared in the original material are included within the quotation marks; all others follow the closing quotation marks. (Exceptions to the rule are widespread …) Double quotation marks are reserved for quotations within quotations. This system … may be appropriate in works of textual criticism or in computer coding and other technical or scientific settings.
In short, where the US style of punctuation can cause confusion in technical documentation, where precision is essential, the UK style of punctuation can be substituted:
- ✔ Provide the password by typing 'password'.
- ✔ Provide the password by typing password.
However, what Chicago (and most style guides) would advise against doing (in the US) is using a hybrid of US and UK styles:
- ✘ Provide the password by typing "password".
Here, US-style double quotation marks are used with UK-style punctuation. While a few companies and people will do this, it's nonstandard and goes against conventional guidance. It at least has the appearance of being a mistake due to a lack of awareness of US-style punctuation.
In short, (1) rephrase the sentence so the quoted word or phrase is not positioned at the end of the sentence in the first place, (2) put it in italics, or (3) use UK styling.
Note that some in-house styles will use a different font face (such as courier) or style instead of italics in order to distinguish a word treated as a word from the body of the text.