If house-elves must obey their master’s orders, can they be ordered to kill?
I'm not sure if there's canon info on direct orders to kill, but there's most certainly proof that they can be ordered to take actions that will result in other people's deaths. Dobby was ordered not to tell anyone about the consequences of opening the Chamber of Secrets, and he didn't, even though it was almost certainly going to result in people dying (and he knew so, as he specifically tried to save Harry Potter from death even at the cost of grievously injuring him).
Whether that is equivalent to killing, is a deep ethical/philosophical question that would take a book (and a different SE site) to untangle.
Yes, (or at least they can be order to kill themselves)
The Grade 2 WOMBAT test that Rowling posted on her website in September 2006 included the following question about house-elves.
Question 7 out of 18
Which of the following statements on house-elves is FALSE?
☐ House-elves have an average life-expectancy of 200 years
☐ A house-elf's allegiance is foremost to its house (rather than to the inhabitants of the house)
☐ House-elves cannot be ordered to kill themselves
☐ House-elf magic is sufficiently powerful to override wizards' enchantments
☐ House-elves breed infrequently and then only with their masters' permission
W.O.M.B.A.T. Grade 2, Part One, Question 7
As determined by Roonwit's answer key (compiled by obsessively retaking the test to determine how different answer choices affected one's grade), the third choice was the only one that awarded full credit.
Thus, if the statement that "House-elves cannot be ordered to kill themselves" is false, then we can conclude that a house-elf CAN be ordered to kill themselves.
It is unknown if they can be ordered to kill other people though.
Probably, but it’s not certain.
There doesn’t seem to be any limitations on the “ethics” of what house-elves can be ordered to do. While no house-elf is ever directly ordered to kill in the books, there’s nothing that really implies house-elves would be somehow prevented from receiving orders to kill. We know that house-elves have to obey their orders, whether they like them or not. We also know house-elves don’t have a species-wide aversion to killing, as Dobby was quite willing to commit murder by chandelier.
They also took part in the battle at Hogwarts, armed with knives, so they can enter combat. There doesn’t seem to be anything at all stopping them from harming wizards. At the Battle of Hogwarts, they stab Death Eaters. While that was their own choice, it shows there’s nothing that prevents house-elves from being able to harm wizards.
“The house-elves of Hogwarts swarmed into the Entrance Hall, screaming and waving carving knives and cleavers, and at their head, the locket of Regulus Black bouncing on his chest, was Kreacher, his bullfrog’s voice audible even above this din: ‘Fight! Fight! Fight for my master, defender of house-elves! Fight the Dark Lord, in the name of brave Regulus! Fight!’
They were hacking and stabbing at the ankles and shins of Death Eaters, their tiny faces alive with malice, and everywhere Harry looked Death Eaters were folding under sheer weight of numbers, overcome by spells, dragging arrows from wounds, stabbed in the leg by elves, or else simply attempting to escape, but swallowed by the oncoming horde.”
- Harry Potter and the Deathly Hallows, Chapter 36 (The Flaw in the Plan)
Ron said “we can’t order them to die for us” implying that they could have, but he didn’t think it would be right.
“The house-elves, they’ll all be down in the kitchen, won’t they?’
‘You mean we ought to get them fighting?’ asked Harry.
‘No,’ said Ron seriously, ‘I mean we should tell them to get out. We don’t want any more Dobbys, do we? We can’t order them to die for us –”
- Harry Potter and the Deathly Hallows, Chapter 31 (The Battle of Hogwarts)
In short, while it’s not confirmed, it seems quite likely that house-elves could be ordered to kill.
We have no definitive example of an elf being ordered to kill.
There are only four instances in the series that I can think of where humans are threatened with violence by the actions of a house-elf. On each of those occasions the attack was instigated by the elf itself and not ordered by any human master.
In the first case, Dobby attacks Harry with a Bludger. This is something that Dobby chose to do of his own volition and his intention was to injure, not kill.
"Your Bludger?" said Harry, anger rising once more. "What d'you mean, your Bludger? You made that Bludger try and kill me?"
"Not kill you, sir, never kill you!" said Dobby, shocked. "Dobby wants to save Harry Potter's life! Better sent home, greviously injured, than remain here, sir! Dobby only wanted Harry Potter hurt enough to be sent home!"
(Chamber of Secrets, Chapter 10, The Rogue Bludger).
In the second case, Dobby attacks the Malfoys and their Death Eater friends. Dobby drops a chandelier on top of Bellatrix Lestrange and disarms Narcissa Malfoy. It's not clear whether Dobby intended either of these attacks to be fatal. However, the fact that he disarms Narcissa rather than causing her any actual harm indicates that his priority was rescuing Harry and co, not killing Death Eaters. And, again, Dobby is clear that he is acting on his own initiative rather than following the orders of a human master.
"Dobby has no master!" squealed the elf. "Dobby is a free elf, and Dobby has come to save Harry Potter and his friends!"
(Deathly Hallows, Chapter 23, Malfoy Manor).
In the third case, as cited by Bellatrix's answer here, Kreacher and the other Hogwarts elves attack the Death Eaters at the Battle of Hogwarts. It's unclear whether their actions were intended to be fatal but the presence of knives and cleavers probably points in that direction.
The house-elves of Hogwarts swarmed into the Entrance Hall, screaming and waving carving knives and cleavers, and at their head, the locket of Regulus Black bouncing on his chest, was Kreacher, his bullfrog’s voice audible even above this din: "Fight! Fight! Fight for my master, defender of house-elves! Fight the Dark Lord, in the name of brave Regulus! Fight!" (Deathly Hallows, Chapter 36, The Flaw in the Plan).
We can't say for certain but it doesn't seem likely that the elves were ordered into battle. The way in which Kreacher is rallying the troops suggests to me that he was the one who instigated the uprising. If someone in authority (say McGonagall) wanted the elves to fight then they would surely have made them take part from the onset. The fact that the elves joined in halfway through indicates that they spontaneously decided to take up arms, presumably as the result of a rousing speech by Kreacher. This is another example of elves acting independently rather than as a result of human commands.
In the fourth case, Kreacher attacks Mundungus Fletcher.
"Sirius never cared about any of the junk -"
There was the sound of pattering feet, a blaze of shining copper, an echoing clang and a shriek of agony: Kreacher had taken a run at Mundungus and hit him over the head with a saucepan.
"Call 'im off, call 'im off, 'e should be locked up!" screamed Mundungus, cowering as Kreacher raised the heavy-bottomed pan again.
"Kreacher, no!" shouted Harry.
Kreacher's thin arms trembled with the weight of the pan, still held aloft.
"Perhaps just one more, Master Harry, for luck?"
"We need him conscious, Kreacher, but if he needs persuading you can do the honours," said Harry.
(Deathly Hallows, Chapter 11, The Bribe).
This is the most useful example for the purposes of the question. Although note again that it is the house-elf themselves and not a human that initiates the violence. Kreacher attacks because he is offended by Mundungus's disregard for the Black family heirlooms. Nobody commands him to do so. But Harry, his master, does promise Kreacher permission to harm Mundungus if he is unhelpful. It's highly dubious that Harry would permit, far less intend, Kreacher's theoretical attack on Mundungus to be deadly. But the example shows that violence by house-elves against humans can indeed be sanctioned by human masters. It shows that house-elf magic is strong enough to overcome human magic since Kreacher overpowered Mundungus. And it shows that house-elves can be receptive, given the right circumstances, to carrying out orders to harm wizards and witches.
Nevertheless, strictly speaking we have no canon example with which to answer this question. At no point has a human ordered an elf to kill, so we can't know how that elf would respond or what would happen. We do know from the example of Kreacher and Mundungus that elf-wizard violence can be ordered and carried out. But attacks by house-elves in the series are overwhelmingly initiated by the elves themselves.
However, I'd say that it's more likely than not that elves will kill on demand. As the question says, we know that house-elves are duty-bound to obey their masters. There don't appear to be any parameters on the kinds of orders that can be given so murders would be part of the job. Of course, that's not to say that, if the target was strong enough, the murder attempt wouldn't be unsuccessful. I can't see Winky vs Voldemort ending very pleasantly.