The Edinburgh author said he was happy to discuss "pretty much anything except politics" on his page, which has more than 130,000 followers.
But Inspector Rebus's creator said he had made himself a rule to avoid politics, despite being regularly asked about Scottish independence, Donald Trump and Brexit when its out on tour.
However he admitted that his much-loved retired detective would be "confused" by the looming prospect of Brexit as he "doesn't like change,"
Speaking at an event at Liverpool Hope University, Rankin said: "I don’t get into politics on Twitter.
"You can only make enemies, you can’t really make friends. That’s one of the rules I’ve made myself; you can talk about pretty much anything expect politics.
"Don’t swear and no drunk tweeting. That’s when things can go really pear-shaped.
“I get asked about politics a lot when I’m on tour. I was in America in January and February and a lot of people were asking about Brexit and why it was happening.
"Prior to that I was asked a lot about Trump or Scottish independence.
"Why would you want to ask a novelist about politics? I don’t want to influence anyone’s politics I just want them to buy books and enjoy reading them.”
“What would Rebus make of Brexit?” he said. “He would be confused by it. He doesn’t like change, he fears it and is set in his ways. The world is shifting rapidly around him in ways he doesn’t understand.
“He’s in his mid-60s and doesn’t understand Twitter. He barely understands the internet and doesn’t use it at all so for him this whole thing is confusion. He’s not a very political animal.
“I don’t think he’d be pro-Brexit but he’d be wondering how it affects him. Does it affect him?
“Someone like Siobhan Clarke a much younger character would be more politically aware. College educated, liberal in her views.
“Rebus is an Old Testament kind of guy; often in the books I’m having an argument with him about how the world works. Showing him it’s not just black and white, good and evil, there are gradations."
Meanwhile Rankin insisted he had no idea when Rebus was likely to be killed off, saying he wad not sure when he started a new book whether the character would be killed off by the end.
He added: “I just do it a book at a time. Someone like JK Rowling knew from the get-go how many books there would be in the Harry Potter series and how it would end.
"I’ve never known how many Rebus books there are going to be or where it goes.
“I’m just happy when there’s one more book. When I start writing a new book I’m never sure if Rebus will be alive or dead at the end.
“The book might say ‘This is it’. If the book tells me it’s his time, then it’s his time.
“I thought I was finished with Rebus anyway after 17 books and he retired.
"I spent five years not writing about him and I was quite happy. Then I got an idea for a cold-case book and I thought this is just the perfect guy to tell that story and that was him back. He just keeps breaking and entering – forcing his way back in."