Ah, the dreaded dialogue formattingsomething that many people get right, but many more get wrong. Where do you use a comma and where a period? What should be capitalized and what shouldn't? And why? Dialogue formatting isn't easy to get right, and it's easy to forget the rules, especially when published authors do it too. But, just as in the rest of the rules of grammar, dialogue formatting has its own reasons for what's correct and what's not, and hopefully once you know why commas go here and periods go there, and this is capitalized and that isn't, you can keep this in mind when you write people talking to each other. Note that most of my examples are canon pieces of dialogue, but some are off the top of my head.
Let's start with something simple. Here is a piece of correctly formatted dialogue:
"No, I am your father," Darth Vader said.
Look at the word "said". That is what's known as a dialogue tag; tags are verbs that connect the dialogue itself to the rest of the sentence. Other tags include "asked", "exclaimed", "replied", and all those variations. Dialogue tags are ways of describing the dialogue, if it's being said, or asked, or screamed, etc.
One of the most important things to know about tags is that on their own, or with only a subject or subject pronoun, they are fragments, which are incomplete thoughts. Every single dialogue tag is a transitive verb, which means that they require direct objects to be part of a complete sentence. A direct object, for those who don't remember, is what the subject of the sentence does an action to. In the sentence "the boy caught the ball", for example, "the ball" is the direct object because it is what the subject (the boy) is committing an action (catching) upon.
And the direct object of a dialogue tag is the dialogue itself. This means that the dialogue is part of the same sentence as the tag, and they therefore must be connected to each other. To continue using my example:
"No, I am your father." Darth Vader said.
There is now a period after "father" in the dialogue, and because periods signal the completion of a sentence, what should be one sentence has become two: "No, I am your father" and "Darth Vader said" are separate. But remember, "said" is a transitive verb that requires a direct object! Because its direct object is now part of another sentence, it is now a fragment, and an incomplete thought. It is the job of a comma to connect parts of a sentence to each other, which is why the original formatting is correct.
Let's extend the idea.
"No, I am your father," he said.
All I did was substitute a proper noun for a pronoun, which is not capitalized. That is because the dialogue and "he said" are still part of the same sentence, and you wouldn't capitalize a pronoun in the middle of a regular sentence, would you? (Unless you're speaking to or about a divine being, which Darth Vader certainly is not, despite the Christ parallelsyou can write "No, I am your father,' He said" only if the person speaking it is God.)
It's for the same reason that you wouldn't write something like:
"No, I am your father." He said.
The "He said" is still a fragment! I don't think I can emphasize that enough. Dialogue tags set apart from their dialogue with periods are fragments. The dialogue tag and the pronoun in front of it are still part of the sentencetreat them that way by using a comma and not capitalizing the pronoun.
Let's switch it around a bit. You can capitalize the pronoun, but only if it's at the beginning of the sentence, like this:
He said, "No, I am your father."
In this case, the pronoun is capitalized only because the beginning of a sentence is capitalized. Note that there is still a comma connecting the dialogue tag to the dialogue; the only difference is that the tag is now in front of the dialogue, and not after.
Maybe now you're wondering why the beginning of the dialogue is capitalized in the above exampleafter all, it's still inside the sentence, isn't it, and aren't you not supposed to capitalize random words inside a sentence? Dialogue gets away with it because it's a sentence within a sentencethe dialogue is its own sentence, but it's still part of the overall sentence that contains a dialogue tag. That's also why dialogue can be said on its own, without a tag, but there can't be a tag without its dialogue. It's also why you can use question marks, exclamation points, dashes, and ellipses instead of a comma: question marks and exclamation points usually signal the end of a sentence themselves, but not alwaysyou understand, don't you?but periods are more final.
Now moving on to continued dialogue.
"No, I am," he said, "your father."
Continued dialogue, also known as interrupted dialogue, is one sentence of dialogue interrupted by a dialogue tag and continued after the tag. All the rules still apply. For instance, you wouldn't write
"No, I am," he said, "Your father."
any more than you would write
"No, I am Your father," he said.
It's still the same dialogue sentence, it's just that you're putting the dialogue tag in the middle. If you capitalize the word after the dialogue tag inside the continued dialogue, then that's just as if you were capitalizing that same word in a regular sentence.
That's also why you wouldn't do things like
"No, I am," he said. "Your father."
or
"No, I am," He said, "your father."
It's all still part of the same sentence, so only capitalize words that should be capitalized (meaning proper nouns and the beginning of the sentence), and don't break the sentence apart to create fragments.
But this does not mean that every dialogue dialogue tag more dialogue structure is continued dialogue. For example:
"He told me enough," Luke said. "He told me you killed him!"
"He told me enough" and "He told me you killed him" are both grammatically complete sentences. The second part is not a fragment if it is not connected to the first, and the dialogue tag is already attached to dialogue. "He told me enough,' Luke said" is just as much a complete sentence as "He told me you killed him" is.
But it is a fairly common mistake to say things like:
"He told me enough," Luke said, "He told me you killed him!"
The above sentence is an example of a comma splice, where a comma connects two (or more) complete sentences without the medium of a conjunction (and, then, etc), and which is a version of a run-on sentence. It would be like writing "He told me enough, He told me you killed him", which is both improper capitalization and a comma splice. A way of telling the difference between continued dialogue and two separate dialogue sentences is to get rid of the dialogue tag and see if the sentence still makes sense and is grammatically correct.
You can only put two complete sentences of dialogue together in the same sentence if you connect them with either a dialogue tag and a conjunction, or another dialogue tag after the first, like:
"He told me enough," Luke said, and added, "He told me you killed him!"
It would also be acceptable to leave off the second dialogue tag, though it's best to leave it in to clarify. But you have to have some way of indicating that the two separate sentence of dialogue are just thatseparate. Giving each sentence its own dialogue tag does that. You could also write it as:
"He told me enough," Luke said, adding, "He told me you killed him!"
You just have to make it clear that they're two separate sentences, which using one dialogue tag for both of them wouldn't do.
What about dialogue non-dialogue tag dialogue?
"No, I am," Vader paused, "your father."
You shouldn't do that. Interrupted/continued dialogue should have a dialogue tag as the interrupter, so it would say:
"No, I am," Vader said, pausing, "your father."
If you want to have an interrupter without the dialogue tag, then you must make it clear that the action is interrupting the dialogue by using dashes or ellipses, so that it would say something like:
"No, I am" Vader paused, "your father."
or
"No, I am " Vader paused, " your father."
Note that there must be a comma before the dialogue is resumed. This is to show that the interrupter is still part of the sentence, and not way out in left field with no punctuation to visibly connect it to the dialogue.
Acceptable style would also be:
"No, I am"Vader paused"your father."
But this can only be used for dashes, not ellipses. Ellipses are to show a slowing down or trailing off of thoughts, while dashes lead directly from one thought to another, so ellipses wouldn't make sense in this case, since you wouldn't want to s l o w l y get to Vader's pause and then back to the dialogue.
So, how about we move on to dialogue and sentences without dialogue tags?
"Together we can rule the galaxy as father and son." Darth Vader stretched out his hand to his son.
These are also two complete sentences, and there is no tag that needs its direct object dialogue to be complete. But say that instead you write something like:
"Together we can rule the galaxy as father and son," Darth Vader stretched out his hand to his son.
Comma splice! It's two complete sentences being connected to each other through a comma when they don't need that connection. It's the same if you put the dialogue after the regular sentence, like:
Darth Vader stretched out his hand to his son, "Together we can rule the galaxy as father and son."
It's just as much a comma splice as before; the only difference is the positioning of the sentences.
Also, for sentence fragments that aren't dialogue tags and are connected to dialogue, like:
Stretching a hand, "Together we can rule the galaxy as father and son."
It's just a fragment attached to dialogue, and incorrect. You need to either add a dialogue tag, to read something like:
Stretching a hand, he said, "Together we can rule the galaxy as father and son."
or make the regular sentence complete, like:
He stretched out a hand. "Together we can rule the galaxy as father and son."
Attaching a non-dialogue tag fragment to a piece of dialogue is not correct at all, because it makes the entire sentence a fragment.
What about things that could be either tags or regular verbs? Take, for instance:
"No!" he screamed.
and
"No!" He screamed.
Both are correct, depending on what you're trying to say. If he screamed the word "No", then the first example is correct. But if he said the word "No", and then screamed, then the second example is the one you want. The dialogue tag is a way of describing the dialogue, so if you're describing the dialogue as being screamed, then it's a dialogue tag, and needs to be not capitalized.
Also, please do not forget the rule of new speaker, new paragraph. Every time a different person speaks, that person should get his or her own paragraph. Take the following two examples:
"Obi-Wan never told you what happened to your father," Vader said.
"He told me enough. He told me you killed him!"
"No, I am your father."
and
"Obi-Wan never told you what happened to your father," Vader said. "He told me enough. He told me you killed him!" "No, I am your father."
The second example is much more confusing than the first, because it's much harder to tell who is saying what. The new speaker, new paragraph rule clarifies when there's a new person speakingotherwise, it would seem that Vader was the one saying, "He told me enough." And we all know that's Luke's line.
The only exception for this rule is if two people are saying something at the same time. In that case, you can say something like:
Han grabbed Leia by the arm. "Come on, Your Highnessness, we've got to get out of here," he said, just as she exclaimed, "Let go of my arm!"
But each piece of dialogue has to be part of the same sentence, to show that they're going on at the same time. And while this kind of thing is acceptable, it would probably be better if you split it into two paragraphs anyway, so it would say something like:
Han grabbed Leia by the arm. "Come on, Your Highnessness, we've got to get out of here," he said.
"Let go of me!" she exclaimed at the same time.
But no matter what, you've got to make clear who is saying what.
What about when what one person is saying requires more than one paragraph, because that person switches topics in the middle of the dialogue?
"Flying's not that hard," Luke explained. "Or at least, it isn't to me. I just tend to know by instinct when to turn and when to keep going straight, how hard and how quickly I need to turn, and all of that.
"Anyway, I'm hungry. Why don't we go eat?"
The first paragraph of dialogue does not have closing quotes, to show that the dialogue is not over and the dialogue right after it is still being spoken by the same person and not a new speaker. But the next paragraph does have beginning quotes, to show that it's still dialogue and not a regular sentence. This pattern continues no matter how many paragraphs the character's speech is.
Dialogue can also be embedded within a sentence.
With pain wracking his body, Luke shouted, "I'll never join you," and inched backward on the gantry.
The dialogue is fine in the middle of a sentence as long as it follows all the other rulesit has to be connected with commas. If you wanted Luke to be exclaiming that so there's an exclamation point at the end of the dialogue (this also works for question marks), it can read like:
With pain wracking his body, Luke shouted, "I'll never join you!" and inched backward on the gantry.
The exclamation point at the end of the dialogue takes the place of a comma, just as it would in a dialogue dialogue tag structure.
If the dialogue tag comes before the dialogue, you can use a colon instead of a comma.
Darth Vader said: "No, I am your father."
This is not commonly used anymore, but is still correct; a colon is an indicator of a close, direct relationship between parts of a sentence, and can be used after a dialogue tag to indicate the tag's relationship to the dialogue. However, if the sentence is structured with the tag after the dialogue, like:
"No, I am your father," Darth Vader said.
it can't be used as
"No, I am your father:" Darth Vader said.
Colons are used to indicate further thought, and can't be used to signal the end of a thought, and so can't be used to close dialogue.
Connections. That's what grammar ishow sentences and parts of sentences are connected to each other, how they're related to each other. And just like a family tree, those relationships can be pretty complicated and easy to confuse, but once you understand exactly how one part of a sentence relates to another, it's much easier to remember. I hope that I helped with that understanding, though if you have further questions, don't hesitate to ask, and I will explain to the best of my ability.