Kendrick Lamar collaborated with Taylor Swift so his niece would think he's ''cool''.

The 27-year-old rapper provided a verse for the star's latest single 'Bad Blood', and revealed he was inspired to do the song because it's more child friendly than anything he has released on his own.

He said: ''This is for my little niece to think I'm cool.

''I like the fact my little niece can dance to it.''

Although the two artists come from different backgrounds, Kendrick - who released his third record 'To Pimp a Butterfly' earlier this year - insisted they got on well while working on his rap.

Speaking about the time they spent together in the studio, he said: ''We just went in there and vibed out.''

The 'King Kunta' track maker also featured in the accompanying star-studded video for the single - which broke Vevo's 24 hour viewing record by racking up 20.1 million views when it was released last month - and said they had a good time shooting the action hero inspired clip because the 25-year-old singer is ''dope''.

He told BBC Radio 1's Annie Mac: ''She's gangster man. She's hard. We had fun.

''She's just a cool person who makes really dope music.''