Just a few years ago, the thought of a tech entrepreneur conjured up an image of a young, nerdy male in baggy pants, an old T-shirt and huge glasses coding in a windowless dorm room until the wee hours of the morning.

All of that is changing.

Just look at photos of Twitter’s 37-year-old leader Jack Dorsey in his Hermès sweaters and Dior shirts (not to mention his model and actress girlfriends). Or the Instagram feed of Tumblr founder David Karp, 27, who could be the poster child for the hipster set with his swooping hair, flannel shirts and skinny, skinny jeans.

It’s not just their clothing that is chic. YouTube co-founder Chad Hurley, 36, regularly posts pictures of himself partying at the world’s hottest spots. (He calls Chateau Marmont, a playground for the rich and famous in West Hollywood, his “home away from home.”) Even Facebook’s famously low-key Mark Zuckerberg recently enjoyed a night out at Boujis, an exclusive club in Barcelona whose London outpost is a favorite of the royals, after acquiring WhatsApp for $19 billion.

If you look at where they started, you can see how far they’ve come, style-wise. Dorsey was a kid with disheveled hair, facial piercings and what Silicon Valley personal-brand consultant and stylist Joseph Rosenfeld calls “a really alternative kind of look” when he launched Twitter in 2006. Elon Musk, 42, a billionaire entrepreneur who leads Tesla Motors and SpaceX, now dresses like he just stepped out of a Calvin Klein ad, with tight black T-shirts and designer jeans. He could have been called a slob in the mid-2000s when he wore loose-fitting, brightly colored T-shirts and baggy pants.

WhatsApp founders — Jan Koum, 38, and Brian Acton, 42 — dress how Musk and Dorsey did before striking gold, letting themselves be photographed in hoodies and khaki cargo shorts. “It’s going to be really interesting to see how they evolve now,” said Brooke Hammerling, owner of Brew Media Relations, which represents tech start-ups.

The tech elite don’t always appear at their best, of course. You still see them walking around in hoodies, especially when they are addressing millennials or immersed in a tech environment. What has changed is their knowledge of how to look put-together and their willingness to do so when the occasion arises.

In many ways, it’s a natural progression.

“Look at the actresses who are famous now. If you look at the red carpet from 10 years ago when they were starting out, you go, ‘Oh dear God,’ ” Hammerling said. “People get more of a sense of themselves.”

Many tech entrepreneurs say it is more than that. Steve Martocci, a co-founder of GroupMe, a messaging service that was sold to Skype in 2011, said developing a company was such an all-consuming process that he didn’t have time to focus on his health, let alone his personal style. “You are looking at what is doing well and what’s not, so, okay, the business is doing well, so I can stop — but dude, look at yourself in the mirror.” In the year after the acquisition, Martocci lost 50 pounds and bought a new wardrobe, and he now takes great care with his appearance.

Other entrepreneurs start focusing on their looks when they are thrust into the spotlight, something that happens once their companies become larger and more valuable. “So many people are following technology founders, and there is a lot of money around what people are doing in technology,” Rosenfeld said. “So there is increased and improved visibility. . . . They are what I refer to as today’s current rock stars or today’s star athletes.”

Karp said that once Tumblr got bigger and fans started approaching him on the street in the Williamsburg neighborhood of New York, he started getting his hair cut much more regularly and even practiced a pose that would make him look better in photos taken with followers. “There were so many bad pictures of me out there,” he said, laughing. “I wanted them to be better.”

Martocci said one bad picture of him that all the media outlets used made him want to change. “I didn’t shave for a while, my hair was unmanageable and it was just like, ‘Do something!’ ” he said. “I did want to show myself in a better light.”

Then there are the events — black-tie galas at art galleries, Hollywood soirees, club nights in New York City. “Their worlds are opening up, and they are becoming more aware of what’s out there, and they get to have more fun with it,” said Hammerling. “And they have more disposable income to do it with.”

Perhaps the greatest force of change, however, is the attention from the business community: investors, boards of directors and even TV talking heads who expect professionalism in both behavior and looks.

A pivotal moment in Martocci’s life was when he showed up for an interview on Bloomberg TV in flip-flops and a baseball cap. Bloomberg executives called him out on it, he said. He realized that he was in an entirely new league and had to do something to upgrade his looks.

In a Vanity Fair profile, Dorsey said he took out his nose ring after Twitter’s first round of financing — no doubt to show financiers he was a serious, reliable adult. Rosenfeld said that was the right thing to do. “He really needs to look like he is worthy of investment from other people,” he said.

Tech entrepreneurs aren’t simply mimicking strait-laced financial types but forging a new style. Dorsey and the Twitter management team did not suddenly wear pinstripes and pink socks to fit in with Wall Street; rather, they wore black blazers and jeans that showed respect without forgoing their own identity. YouTube’s Hurley went so far as to launch his own fashion label, Hlaska, to provide stylish clothes that would also suit the laid-back vibe of Silicon Valley.

Hammerling, who is based in New York, says this style might be creeping into other business sectors, including finance. “I can go weeks without seeing a person in a suit,” she says. “That’s crazy!”

Of course, there is the fact that the fashion world wants to integrate itself with the next big technology venture. As early as 2012, Diane von Furstenberg adorned her models in Google Glasses for a New York fashion show, even seating Google co-founder Sergey Brin in the front row, a spot usually reserved for socialites, models and movie stars. At this year’s New York Fashion Week, there was a hackathon and a keynote address by Foursquare co-founder Dennis Crowley. And who knows what Anna Wintour and Dorsey are cooking up when they are together at so many parties.

“I think you are starting to see technology and fashion really partner up in more ways,” Hammerling says. “I think that as these kids end up on the billionaire list and the richest-kid list, even fashion wants to be connected to that.”

Krueger is a freelance writer.