New York didn’t invent the apartment. Shopkeepers in ancient Rome lived above the store, Chinese clans crowded into multistory circular tulou, and sixteenth-century Yemenites lived in the mud-brick skyscrapers of Shibam. But New York re-invented the apartment many times over, developing the airborne slice of real estate into a symbol of exquisite urbanity. Sure, we still have our brownstones and our townhouses, but in the popular imagination today’s New Yorker occupies a glassed-in aerie, a shared walk-up, a rambling prewar with walls thickened by layers of paint, or a pristine white loft.

The story of the New York apartment is a tale of need alchemized into virtue. Over and over, the desire for better, cheaper housing has become an instrument of urban destiny. When we were running out of land, developers built up. When we couldn’t climb any more stairs, inventors refined the elevator. When we needed much more room, planners raised herds of towers. And when tall buildings obscured our views, engineers took us higher still.

This architectural evolution has roughly tracked the city’s financial fortunes and economic priorities. The turn-of-the-century Park Avenue duplex represented the apotheosis of the plutocrat; massive postwar projects like Stuyvesant Town embodied the national mid-century drive to consolidate the middle class; and the thin-air penthouses of Trump World Tower capture the millennial resurgence of buccaneering capitalism. You can almost chart income inequality over the years by measuring the height of New York’s ceilings.

The apartment was not always the basic unit of Manhattan life. To the refined nineteenth-century New Yorker, the idea of being confined to a single floor, with strangers stomping above and lurking below, was an intolerable horror, fit for greenhorns and laborers. Even circa 1900, Edith Wharton’s socially sensitive anti-heroine Lily Bart in The House of Mirth has strong opinions about what sort of female belongs in a flat, instead of a proper house: “Oh, governesses—or widows. But not girls!”

It took decades to cajole respectable New Yorkers out of their single-family homes. In 1857, Calvert Vaux, who later became Frederick Law Olmsted’s partner in the design of Central Park, proposed a four-story, wide-windowed, thoughtfully designed set of “Parisian Buildings.” His drawing included an elegantly dressed couple entering the lobby, but that was wishful thinking. While the city’s population surged after the Civil War, and newcomers jammed into dank and rickety brick tenements, the affluent clung to increasingly exorbitant houses, even as they could hardly afford to build more of them. “Nothing denotes more greatly a nation’s advancement in civilization than the ornate and improved style of its architecture and the erection of private palatial residences,” the Times noted wistfully in 1869. With real-estate values spinning out of control, the editorial concluded that the only realistic way to beautify the city was to erect more mansions for sharing: “the house built on the French apartment plan.” If such a dubiously Continental innovation could be made to seem palatable, even splendid, to the upper crust, the bourgeoisie would surely follow.

The first building to overcome these sensitivities was Richard Morris Hunt’s Stuyvesant Apartments at 142 East 18th Street, a luxurious behemoth by 1870 standards. This structure defeated doubters with a two-pronged argument of aesthetics and pragmatism. The architecture oozed dignity: Five stories high and four lots wide, it had an imposing mass, an overweening mansard roof with yawning dormers, wrought-iron balconies, and ornamental columns. Even more persuasively, compared with the cost of building, furnishing, cleaning, and repairing a private home, all this respectability came as a bargain. Within a few years, the Times announced that a “domiciliary revolution” had taken place: a happy epidemic of flats had beaten back a plague of sinister boardinghouses. Young couples could now afford a bright new place in town; families no longer needed to fan out to the villages that lay miles from Union Square. The change represented the triumph of pragmatism over prejudice. “Anglo Saxons,” the Times reported, “are instinctively opposed to living under the same roof with other people, and it is doubtful if [that resistance] would have been overcome had not the earliest flats been of an elegant kind, in the best quarters of the town, and therefore, expensive and fashionable.” The rich made the apartment safe for the middle class.

Respectability was a crucial issue in a society as fluid as New York’s, where those who had achieved preeminence kept it only by erecting rigid social distinctions. In The House of Mirth, Wharton charts Lily’s decline by plotting her narrowing real-estate choices: She moves from a relative’s house to a spare, lonely apartment and then, after a brief stint as a social climber’s paid companion in a decadently luxurious hotel, she drifts even further downward to a shared one-room flat. She finally winds up in a boardinghouse, one step from the gutter.

Developers adopted an assortment of strategies to dispel qualms about apartments’ suitability. In 1884, the Chelsea opened as one of the city’s first luxury co-ops, sparing residents the indignity of living in hired quarters. (Having evolved from an owner-occupied enclave of the well-to-do into the storied and famously shabby Chelsea Hotel, it is now on the cusp of going condo; you can read about it here.) That same year, the Dakota offered crowd-shy burghers access to Central Park just outside their gate and, inside, a quiet courtyard enclosed by a mock château replete with peaked gables, bays, quoins, and wrought-iron railings. These lavish touches effectively collectivized social status: Whereas the one-family mansion declared its owner’s separate prominence, the Dakota’s bulk and ornamental façade signaled that everyone who lived there was, by definition, Our Sort.

The apartment building’s most persuasive asset, though, was that it allowed the affluent to live better than ever while still downsizing the household staff. There were savings in numbers: In a large building, the cost of steam heat, electricity, and elevators could be shared. Instead of each family’s employing a laundress, one or two building employees manned huge machines in the basement. Residents of the finer addresses took their meals in vast and elegant central dining rooms, like passengers on a perpetual cruise. Those who preferred to eat at home but lacked a cook could have their cleverly boxed, lukewarm meals sent up by dumbwaiter. (New Yorkers always were addicted to takeout.)

By the turn of the century, the mansion had become an albatross, not just expensive but primitive, compared with a giant technological wonderland like the Ansonia Hotel at Broadway and 74th Street, which opened in 1904. This was the bourgeois pleasure dome of early-twentieth-century New York. The young single man who installed himself in one of the 1,400 rooms and 340 suites could choose whether to move in his own bed and chest or select from the hotel’s catalogue of paintings, furniture, carpets, and hand towels. He could scrutinize the other transient and permanent guests by the dazzle of electric lights, dine in a restaurant that served 550, take a postprandial stroll past the live seals cavorting in the lobby fountain, and ride the quiet, exposed elevators just for the pleasure of seeing the seventeen stories scroll by. A few blocks over, the Hotel des Artistes on Central Park West at 67th Street opened in 1917 as live-work space for gentleman artists, who required northern light and high ceilings, even though some residents never touched a palette.

Jews, unwelcome on Fifth Avenue and in the other East Side redoubts of wealth, established Central Park West as their own opulent ghetto. There, the immigrant architect Emery Roth erected the apotheosis of early-twentieth-century domestic grandeur: the Beresford, a fairy-tale confection of towers, wrought-iron grillwork, terra-cotta cherubs, pediments, and balustrades. Each apartment pinwheeled around an entrance foyer, so that the sleeping quarters, public rooms, and servants’ wing could be simultaneously separate and close at hand. Only New York could produce a monument to Jewish home life as imposing as the Beresford, and perhaps only in the late twenties, in the exultant moment before the stock-market crash.

The Depression slammed the portcullis down on the era of residential magnificence. The Ansonia was chopped up into cubbies. The Beresford was sold off for a pittance. The Majestic and the San Remo, planned in flush times, were completed in miserable ones and faced immediate financial trouble. Hundreds of other Upper West Side buildings, more modest but still genteel, adapted to less easeful times. Maids’ rooms were repurposed as bedrooms. Bell boxes for summoning servants were disconnected. Stained-glass windows broke and were replaced with ordinary panes. European refugees found in this habitat of battered prosperity echoes of the apartments they had left behind in Vienna and Berlin.

Savage as it was, the Depression thinned but did not extinguish the ranks of the wealthy, and some sumptuousness did slip through the closing gates. In 1931, the River House materialized on East 52nd Street, and its 27-story tower, flanked by fifteen-story wings, rose over the East River like an ocean liner. Inserted into a neighborhood of slums and slaughterhouses, River House retreated behind its gated court, a citadel reaching far above the gloom. The luckiest residents never needed to dirty a shoe on the cobblestones: They could, if they wished, commute by boat to lower Manhattan or their Westchester estates from the private marina (an amenity later obliterated by the FDR Drive). The photographer Samuel Gottscho captured the thrill of living at these rarefied altitudes, when street level contained so much squalor. The haloed skyline, the chrome-plated water spreading out beyond the great bay windows, the airy apartments washed in morning light, all made River House the Valhalla of New York.

In that first phase in the saga of the New York apartment, the middle class emulated the prosperous in order to separate themselves from the poor. In the next chapter, plain but modern housing for the poor became the standard for everyone else. Widespread hardship, followed by a world war and a housing shortage, plus a multi-decade campaign to flatten differences in income, meant that New Yorkers of all strata were moving into streamlined homes, with lower ceilings and restrained rents.

Affordability and unassuming dignity had always been a goal of apartment advocates. In 1867, 1879, and 1901, Progressives had pushed through laws requiring small increases in the standards of ventilation, light, and sanitation in tenements, which were often disease-ridden firetraps. In the 1870s, the Brooklyn philanthropist Alfred Tredway White built handsome complexes of worker houses like the Tower Buildings in Cobble Hill, which featured a toilet in each apartment, outdoor staircases, meticulous brickwork, and wrought-iron railings. But it was the Depression that brought the issue of how to house the have-nots into the realm of public policy. In 1935, the New York City Housing Authority rehabilitated a neighborhood of crumbling Lower East Side tenements by tearing down every third house to maximize light and air, and renovating or rebuilding the rest. In the end, the First Houses project required near-total reconstruction, but the result inaugurated the public-housing era and remains an emblem of its promise.

Providing apartments to those who needed them proved such a massive undertaking that all levels of government had to get involved. Rent control arrived in 1943, and a smorgasbord of federal, state, and city agencies floated bonds, granted tax breaks, wrote checks, evicted citizens, and redrew maps, all in an effort to scrub putrid slums and erect stands of thick, solid towers instead. Private developers, too, got in on the action. The Metropolitan Life Insurance Company opened Stuyvesant Town as a middle-class gated community around a series of verdant courts. One irony of that contradiction-laced period is that, in order to save the decaying city, densely populated towers cut themselves off from the noise and mess of urban life. This was not because residents wanted to distance themselves from the street but because planners did. “The growing antimetropolitanism of most housing architects [was] matched by the new suburban bias of the bankers, lawyers, and bureaucrats who wrote the programs and administered the policies,” write Robert A.M. Stern, Gregory Gilmartin, and Thomas Mellins in New York 1930.

The story of mass housing is an intricate epic of idealism, destruction, and partial successes. Public projects obliterated neighborhoods, boosted the crime and segregation they hoped to alleviate, killed miles of street life, and vivisected vibrant communities—but they also redeemed a lot of grimly constricted lives. “Before, I lived in the jungle,” one garment worker said at the time. “Now I live in New York.”

“I live in New York.” The optimism buzzing through that phrase brought people here in search of whatever damp, dim, cramped, and clanking digs they could find. Even as the authorities were condemning acres of cold-water walk-ups in East Harlem and the Lower East Side, ­Abstract Expressionist painters were renting similar apartments in Greenwich Village. If for Wharton’s Lily a poky flat represented the last rung before indigence and an early death, for the siblings in Ruth McKenney’s 1940 play My Sister Eileen (and its 1953 spinoff, Wonderful Town), a basement pad in the Village had a raffish, stageworthy glamour. Penury was cool.

So powerful was the ideal of the apartment for the masses that luxury buildings aspired to it, too. Postwar architects embraced the austerities of modernism, which they applied to bourgeois quarters as rigorously as they did to public housing. The most bracing high-end apartment building was Manhattan House, an immense 1951 complex that architect Gordon Bunshaft clad in glazed brick that everyone called white, was actually pale gray, and has always looked slightly unwashed. Stretching along 66th Street between Second and Third Avenues, Manhattan House adapted the grand apartment to the stripped-down modern era persuasively enough to attract Grace Kelly as a resident, and Bunshaft chose to live there, too. But its huge scale, stark design, and chain of slabs sitting back from the sidewalk evoked Stuyvesant Town more than it did the ornate prewar palazzi like the Beresford. Half a century earlier, New Yorkers had hoped to live fabulously. Now it was stylish to live just well enough.

It soon became difficult to distinguish Manhattan House from the knockoffs that developers churned out for less discerning clientele. For a while in the fifties and sixties, it seemed as though every new residential building, whether it contained cramped studios or assembly-line “luxury” pods, wore a uniform of glossy white brick. The postwar pathways of influence resembled the water cycle: an aesthetic of conspicuous sameness, developed for the poor and taken up by the affluent, trickled back to the middle.

The charms of standardization eventually wore thin, and the New York apartment soon experienced a transformation almost as fundamental as it had at the turn of the century. It began when the heirs to the cold-water bohemian culture of Greenwich Village drifted south across Houston Street and discovered a zone of gorgeous dereliction. In the sixties and seventies, the industries that had fueled the city’s growth a century earlier were withering, leaving acres of fallow real estate. At first, nobody was permitted to live in those abandoned factories, but the rents were low and the spaces vast, and artists were no more deterred by legal niceties than they were by graffiti, rodents, and flaking paint. They arrived with their drafting tables, their welding torches, movie cameras, and amplifiers. They scavenged furniture, blasted fumes and music into the night, and gloried in the absence of fussy neighbors. They would demarcate a bedroom by hanging an old sheet.

At a time when urban populations everywhere were leaching to the suburbs, this artists’ colonization had a profound and invigorating effect not just on Soho but on the entire city. The traditional remedy for decay was demolition, but artists demanded the right to stay, their presence attracted art galleries, and a treasury of cast-iron buildings acquired a new purpose. Artists didn’t think of themselves as creating real-estate value, but they did. Few events illustrate the maxim “Be careful what you wish for” better than the Loft Law of 1982, which forced owners to make Soho’s industrial buildings fully habitable without charging the tenants for improvements.

It was a triumph and a defeat. Legal clarity brought another wave of tenants, with more money and higher standards of comfort. As working artists drifted on to cheaper pastures in Long Island City, Williamsburg, and Bushwick, Soho’s post-­pioneers renovated their lofts, hiring architects to reinterpret the neighborhood’s industrial rawness, or merge it with cool pop minimalism, or carve the ballroom-size spaces into simulacra of uptown apartments.

Once everyone wanted to be a tycoon, then everyone wanted to be middle-class. Now everyone wanted to be an artist, or live like one. Soho filled up quickly, and the idea of the loft spread, reinterpreted as a marketable token of the unconventional life, promising to lift the curse of the bourgeoisie through the powers of renovation. Realtors began pointing out partition walls that could easily be torn out. Lawyers, dentists, and academics eliminated hallways and dining rooms, folding them into unified, flowing spaces. Happily for those with mixed feelings about the counterculture, loftlike expansiveness overlapped with the open-plan aesthetic of new suburban houses. Whether in imitation of Soho or Scarsdale, the apartment kitchen migrated from the servants’ area to the center of the household, shed its confining walls, and put on display its arsenal of appliances and the rituals of food preparation (not to mention the pileup of dirty crockery). Cooking became a social performance, one that in practice many apartment dwellers routinely skipped in favor of ordering in, going out, or defrosting a package—but at least the theater stood ready.

Starting in the eighties, when the country more or less abandoned the pursuit of greater equality and success was defined by fresh college graduates who coaxed the financial system into dumping sudden millions in their laps, the apartment took yet another turn. Triumphant traders—“Masters of the Universe,” in Tom Wolfe’s phrase—didn’t spend much time at home, but in their few moments of leisure they wanted to gaze down on the city they had conquered. The ultimate trophy was an imperial view.

For the next two decades, developers treated the apartment less as a private retreat than as a belvedere—a platform for a vista. Clunky towers with floor-to-ceiling windows sprouted around the city, their hurried construction, slapdash design, and astronomical prices justified by the assumption that anyone who walked through the front door would make straight for the windows. The city became a diorama of itself.

The ultimate expressions of the panoramic apartment, which required vertiginous height, very fast elevators, and a perimeter of glass, are the penthouses atop Trump World Tower. This dark bronze totem that Costas Kondylis designed on First Avenue for Donald Trump was the planet’s tallest residential building (and the one most loathed by its neighbors) when it opened in 2001, and it was not shy about its stature. The ceilings got higher near the top, so that the tower appeared to be craning its neck, and the 72 floors were deceptively numbered up to 90. The payoff was an Imax view of the skyline below and the weird sensation that the closest neighbors were gulls, planes, and clouds.

Of course, that sort of solitude only lasts until the next set of neighbors climbs the beanstalk. Already, Frank Gehry’s 867-foot rental tower at 8 Spruce Street has nudged past Trump World Tower, and the hotel-condominium designed by Christian de Portzamparc and currently under construction at 57th Street and Seventh Avenue will shoot above them both to 1,005 feet. The push to refine the apartment began with assurances that a fifteenth-floor home could rival a house set on a fifteen-foot stoop; today, a 150th-floor penthouse is not unthinkable.

Vertical living has behaved as promised: It multiplied the value of limited land, streamlined the machinery of leisure, sheltered the masses, and concentrated entrepreneurial energy into a compact urban zone. But the price of height is lightweight construction: glass walls, thin floors, and plasterboard walls. The original barons of the Beresford would have found today’s condo towers pretty flimsy castles in the sky. And yet New York has done such a thorough job of glamorizing the high-rise apartment that a Manhattan pied-en-l’air has become a billionaire’s accessory and an eternal object of desire. Developers have searched for ways to leverage that lust—to reconcile the assembly-line efficiencies of the construction business with the quest for ever-greater heights of pampering. Enter the preposterous amenity. Today, the most extreme buildings compete to provide a Gilded Age menu of extras: swimming pools, gyms, spas, garages, valet parking, concierge service, room service, housekeeping service, wireless service, rooftop dog runs, party rooms, screening rooms, and so on. You can never be too rich or too comfortable.

In theory, the ultrahigh-rise should not be simply an instrument of extravagant living but a path back to the egalitarian policies of the mid–twentieth century. In his recent book Triumph of the City, the Harvard professor Edward Glaeser argues that New York’s vitality depends on people being able to live here, that the only way to make apartments affordable is to erect more of them, and that means rising higher and higher. If he’s right, then perhaps all the contradictory forces of New York’s real-estate history can somehow be intertwined, and the next generation of apartment buildings can somehow combine affordability with vintage grandeur, great height, and the relentless pursuit of ease. That may seem like an implausible quartet of attributes, but it’s precisely what the first middle-class alternatives to the tenement and the boardinghouse offered 150 years ago.

Almost the entire trajectory of the New York apartment remains on the menu today. To choose an apartment here is to select one particular vision of what New York life can be. The crowds who troop around to open houses every Sunday are never just counting bathrooms and closets or calculating mortgage payments. They’re wondering whether they want to join the centennial parade of families who have occupied this particular enclosure, whether a refurbished tenement speaks of hoary miseries or new excitement, whether the view out each window is one they want to see every day, or whether they can see themselves in their prospective neighbors. To hunt for an apartment is to decide which New York you belong in, and what specific droplet of the city’s fickle soul has found its way into your veins.