Detectives in Kirklees are appealing for information after the man was attacked during what is being treated as a burglary in Heckmondwike.
The incident happened at around 9.30am on Westfield Street on Wednesday.
A West Yorkshire Police spokesperson said: "The victim, who was wearing headphones, was carrying out DIY within his home when he was struck from behind on his head, causing him to lose consciousness.
"When the victim regained consciousness, he found racially aggravated graffiti written on the wall in his home."
He reported the matter to police and was treated in hospital for a minor head injury before being discharged.
Detective Inspector John Charlton, of Kirklees CID, said nothing was taken during the incident.
He added: "I would like to reassure the local community that offences of this nature are extremely rare.
"We are taking the matter extremely seriously and we have increased our patrols in the area," he said.
"We are conducting extensive forensic enquiries in an effort to identify the person or people responsible and are continuing our enquiries locally.
"I would like to hear from anyone who witnessed anything or anyone who noticed anyone acting suspiciously within this vicinity at around this time to get in touch."
Anyone with any information about this incident, or who saw anyone acting suspiciously near the area is asked to contact Kirklees CID via 101 quoting crime reference 13170282561.