Did you know that if you shine an Anglepoise lamp at a rabbit's paws, it can make the silhouette of a children's entertainer? Boom boom: my joke-writing education is underway. I'm in a cafe with standup Tim Vine, grilling him for the trade secrets of the one-liner merchant. The above effort – not bad for a first-timer, if not actually funny – is my stab at what Vine calls "a reversal". His own example is immeasurably superior. "Did you know if you chop a horse in two then bang the halves together, it sounds like someone riding a coconut?"

Vine has just released a book of one-liners, and goes on tour in April. Milton Jones, another master of the mini-joke, embarks on his own tour this week. They are prominent among a select band of standups, who – unlike the more conversational comics who dominate the industry – aren't stumped when the public buttonhole them and demand: "Tell us a joke." Between them, Jones and Vine – and Jimmy Carr and Emo Philips, among others – have thousands: small, perfectly honed hand-grenades of mirth, lobbed repeatedly at the audience in the name of entertainment.

But what kind of brain reduces the world to these bite-sized chunks of silly? And how do they generate so many gags? Vine writes 15 new jokes per day on a postcard. ("Although they don't have to be good," he says.) "It's about turning things upside down," says Jones. "Looking at the things people say and thinking: what's the opposite of that?"

When a joke is hatched, it may leap straight into the comic's set – or it may need refining, like a diamond. "One word can make all the difference," says Jones. "When you eventually get it right, you think: this must exist, surely? There can be a purity about perfect one-liners. It's as if it's not from you." But they are hard to generate – and a one-liner comic needs far more punchlines per show than his or her observational counterpart. "If you come up with a good one-liner, it's over and done with in eight seconds," laments Vine. "I sometimes think: are there more jokes out there?" Fortunately, new coinages and cultural changes refresh the linguistic and conceptual gene pool.

Does this pernickety process attract a certain personality type? Compact joke-writing can seem almost mathematical, as with US comic Demetri Martin, who creates palindromes alongside his mindbending one-liners. "But I failed my maths GCSE three times," says Jones. "If there's a mindset in my case, it's that I think in pictures. What I do is put funny cartoons in people's heads." To Vine, one-liner comedy "attracts people who don't want to say much about themselves. No one learns much about me from my act, except that I've got time on my hands."

One-liner comedy can struggle to sustain a whole show. "After 20 minutes," admits Jones, "you can see blood coming out of the audience's ears. It's too much information." He pre-empts this by varying the rhythm, inserting musical and visual interludes, and keeping jokes that use the same formula apart from one another. "You mustn't let the audience see the workings," says Jones. "Sometimes when a joke doesn't work, I can feel them going, 'I almost thought of that in the pub once.' I have to stay well ahead of that."

Which brings us back to Vine's masterclass. To finish, he offers to create a new joke, on a subject of my choosing. A briefcase, I suggest. Vine cogitates. "Obviously, you want to avoid pants in a case," he says, "or it being about 'a short case'. You want to be more creative than that." Then, after an intense pause, comes the gag. "What if you open it and it's full of coral?" asks Vine. "Then it's a reef case!" Comedy in utero. "It's not great," he says cheerfully, "but it'd go on the postcard."