On any given workday, Brandon Hilkert, 31, might be found sitting in front of his MacBook Air at home in West Chester, Penn., in a coffee shop nearby, or at a co-working space he frequents in Philadelphia called IndyHall. That kind of flexibility, he says, is one of the reasons why he loves his job as a software engineer for a small startup.

More Best and Worst Jobs of 2012

It's also one of the reasons why software engineer was ranked No. 1 in a list of the best jobs of 2012 by CareerCast.com.

CareerCast.com, a career website owned by Adicio Inc. ranked 200 jobs from best to worst based on five criteria: physical demands, work environment, income, stress, and hiring outlook. The firm used data from the Bureau of Labor Statistics and other government agencies to determine the rankings. The 200 jobs were selected for their relevance in the current labor market as well as the availability of reliable data. For instance, enlisted military personnel – the third worst job of 2012 – was added this year thanks to new data released by the Department of Defense.

Mr. Hilkert and software engineers like him are riding a wave of intense demand for people with information-technology skills, thanks to an explosion of data that companies and governments need to gather, analyze and turn to productive uses. The field offers a mid-range income of $88,142, according to CareerCast.com.

Best and Worst Jobs of 2012 See where your job ranks.

The demand translates to something especially enviable in today's job market: a constant drumbeat of interest from recruiters. Mr. Hilkert, who studied mechanical engineering in college but taught himself software programming, receives two to eight calls a month from recruiters trying to lure him into new positions.

But for now, he's happy at his current post at Meeteor.com, a Seattle-based firm that has developed a social-networking platform for young professionals. He earns about $90,000 per year.

It's not all lattes and coding in pajamas, though. If there's a glitch in a program's codes, Mr. Hilkert might be up past midnight searching for solutions. As one of only three employees, he can't delegate crises to someone else. Plus, he's shouldering a fair amount of financial risk by choosing to work for a start-up as opposed to a well-established company. But these are outweighed by benefits such as a sense of intellectual challenge and the ability to see the fruits of his work in fast, tangible ways. "It's really exciting work and that's what matters to me at the end of the day," he says.

Tony Lee, publisher of CareerCast.com, said he wasn't surprised to see software engineers topping the list. But he was surprised to find human resource managers rising to the No. 3 spot. In an era of layoffs, anxious employees, and cutbacks that often reduce back-office functions like HR, he says, he often hears HR managers complaining about the stresses of their jobs.

But with hiring on the rebound for the last few months and expected to heat up further as the economy recovers, the job outlook for human resource professionals is bright, and that brought the career to its high ranking.

Anne Diskin, who runs human resources for MeriCal, a California vitamin manufacturer with 370 people on payroll, says she likes the job's mix of analytical challenges and hands-on interaction with employees.

Related Video

Checking Facebook on work computer isn't a federal crime. That's the opinion of the U.S. Court of Appeals for the Ninth Circuit, anyway. In a ruling by Chief Judge Alex Kozinski Tuesday. Joe Palazzolo has details on the News Hub. Photo: Bloomberg

She adds that the job's stresses and rewards are often the same – helping employees resolve their work and personal troubles. But unlike many of her peers, she hasn't had to do some of the dirtiest work of a human resources manager: handing out pink slips. MeriCal has avoided layoffs during the economic downturn.

The worst job out of the 200 examined? It's lumberjack. The job replaced last year's loser, roustabout, also known as an oil rig worker. With oil prices trending high, hiring for energy jobs is robust, while the ongoing slump in new housing construction has depressed demand for lumber and thus for lumberjacks, says Mr. Lee. Add to that the physical dangers of the job and a midlevel salary of $32,114, and it ranked at the bottom of the CareerCast.com list.

When reached on assignment in a Clatskanie, Ore., forest, Kirk Luoto, 30, agreed he's chosen a dangerous profession. "These trees, there's so much power involved in moving them. A 20,000-pound log can swing around like a baseball bat and hit you." And the pay, which can start at $12-13 per hour, is not commensurate with the risks. "You risk your life every single day out here and you get paid very little for what [you] actually do."

But Mr. Luoto's grandfather and father were both loggers, and his family now owns a small timber firm in Carlton, Ore. "There were times when I thought maybe I should do something different," he says. But he quickly realized he wouldn't be happy in some of the higher-ranked jobs, especially the cubicle-based ones. "I don't like desks," he says.

Write to Lauren Weber at Lauren.Weber@wsj.com