So basically, battleships are awesome. I am interested in creating a setting where they were never superseded in their role of long-range command vessels and fire support by aircraft carriers, preferably without eliminating CVs entirely. But I am unsure how technology and/or military doctrines would have to be different for battleships to not become obsolete.
TLDR: All you need is better Anti-Aircraft Guns
There's a lot of good information here, but I think @Karl actually has the best and simplest answer to the question. Imagine a scenario where instead of pursuing multiple competing and disorganized efforts, the United States and Great Britain went All-In on Radar in the early '30s when it was first starting to show promise.
This likewise drives a lot more interest and investment in ballistic computers as @KerrAvon2055 discussed.
Between those two things, by the '40s you potentially have fire-control systems with the capability to start inflicting reliable casualties on incoming aircraft the moment they come within range, which in the case of high-performing weapons like the notorious German Flak 88 was as much as 15km.
This completely changes the dynamic of naval combat in WW2. Most critically, the PERCEPTION of battleships is retained that a proper design can be almost impervious to all but the largest air attack. Torpedo bombers are almost useless against a ship with defenses like this because their attack profile makes them catastrophically vulnerable to precision long-range anti-aircraft gunnery. Dive bombers become much less effective because they have to release their bombs from higher altitude and use more erratic attack trajectories to have any chance of getting a munition to the target.
In this scenario the kind of investment that leads to massive carrier fleets by the end of WW2 never occurs and instead of devoting more and more resources throughout the '50s and '60s to naval aviation, that money and scientific effort is devoted to massive acceleration in the development of technologies that allow interception of incoming missiles and projectiles.
Instead of becoming the primary offensive weapon, Naval Aviation remains relegated to support roles that don't require them to attack enemy formations. Carriers are smaller, faster, and primarily devoted to reconnaissance and ASW. The primary mission is locating enemy ships and providing targeting information to the battleships.
Best of all, this doesn't require any other technologies to mysteriously not be discovered, it all becomes a question of where the money and attention goes. Without a massive investment in aircraft carries, by the '80s the United States and Russia have fleets of massive battleships protected by the same Aegis missile defenses and Phalanx guns that protected carriers instead. Indeed since you can't rely on massive air wings to intercept incoming waves of cruise missiles with air-to-air missiles, development of defensive anti-missile technology gets vastly more funding and attention.
At this point you can look at all the pie-in-the-sky stuff that the Navy has been trying to put on the Zumwalt-class ships since the '90s and pick the stuff you like. All of it would have worked if enough time and money had been spent on it. Nuclear Powered battleships with laser Anti-Ballistic-Missile defenses? Sure thing! Electromagnetic Railguns firing GPS- and laser-guided projectiles? No Problem! Point Defenses that use shaped charges to intercept incoming hyper-velocity projectiles? You Betcha!
Whew, that was fun to write...
Fuel and point defence
As noted in other answers, aircraft and missiles are key elements in the decline of the battleship. The missiles came later, so let's start by looking at a history in which aircraft didn't get off the ground quite so much.
Aircraft require high fuel density. The Turbinia demonstrated how effective a coal-powered turbine engine could be, leading in short order to the construction of HMS Dreadnought, but coal-powered aircraft were not a viable proposition. Aircraft needed refined oil fuels to work - what if such fuel was much rarer and therefore expensive? The late 19th / early 20th century aviation and automotive industries would have been much smaller, with aircraft being too small and expensive to use for combat although they would still have been valuable for reconnaissance.
Oil scarcity alone might have been enough to allow battleships to maintain dominance for a long time. Still, they may need some help, so what if...
Computers in the old days were big. Really big - taking up rooms worth. Let's imagine that some military funding was thrown at ballistics computer development back in the alternate 1920s and 30s. No miniaturisation, just really big, reliable valve-based ballistics computers that allow fire accuracy over the tens of kilometres that the main guns can fire. Then let some bright spark at a naval academy figure out how to program the computer to not only provide targeting data to allow the main guns to hit an enemy battleship 20km away, but to provide targeting data to allow the small guns to shoot down aircraft.
This makes the battleship dominant up until the mid twentieth century:
- the range and accuracy of the battleship make it impossible for any smaller ship to enter engagement range and survive
- point defence prevents the handful of aircraft or primitive V1-equivalent missiles from surviving in the battleship's skies
- lack of compact fuel sources has reduced the effectiveness of submarines.
Technology can progress from this point. Miniaturisation will eventually make missiles a threat, but as long as point defence software and hardware development keep pace it will not matter. Nuclear power will make submarines a serious threat, but have little effect on aircraft. If you wish to stray into science fiction territory, take a page from David Drake's Hammers Slammers series and allow the development of fusion power plants but make them too large to install in anything smaller than a battleship rather than a tank.
The full answer to this question could fill a small library and I'm quite sure would blow the space limit of the answer box, but I'll try to give you a shortened version you can work with.
Ultimately, the reason battleships developed into their WWII incarnations was range. This in point of fact is what made bows, firearms, cannon, tanks, cruise missiles and ICBMs useful innovations as well. The reality is that if your 'reach' is longer than your opponent's, then you can hurt them from a range at which they can't hurt you.
Now, battleships evolved essentially as floating platforms for big guns. You ended up with ships like the Missouri which were massive but had a relatively small number of guns by comparison to (say) a Ship of the Line from back in the day because the focus changed from rate of fire to range of fire. Having a smaller number of much larger guns, and guns larger than those on the battleships of your enemies, was all important because the range of fire meant that you could eliminate threats and destroy enemies long before they came anywhere near you.
The problem was that in WWII, a new invention occurred, and a second one was refined, which changed that model completely; rockets and aircraft.
Rockets, particularly now in the form of missiles, provide far better range than conventional cannon-based guns and more importantly, don't require the massive ship from which to launch that cannons do because a large percentage of the momentum is added to the payload in flight, not at the point of firing. Aircraft add to this by having a massive flight range, and allowing for targets to be attacked from well outside the range of conventional guns. Put simply, aircraft carriers are still floating platforms for ranged weapons, it's just that the guns have been replaced with smaller flying weapons platforms to increase the range. Same with most guided missile frigates, that also carry the benefit of being a lot smaller, making them harder to hit in combat and cheaper to build.
This last point is especially important because torpedoes made it very cheap to take out a large target like a battleship if you could get the torpedo to its target without being noticed. Torpedo boats and submarines were effectively designed to be battleship killers and were far cheaper to manufacture than a battleship, making them a good deal in terms of strategy.
So; to keep battleships in play, you need a minimum of three changes;
1) No Rockets. Don't let the Axis develop rocket or long range missile technology. You won't get to the moon either but that's another problem. The important thing is that missiles as we currently understand them cannot exist.
2) No Planes, or at least no planes that can use short take-off and landing strips. Without these, your battleships still have a chance of being the most ranged weapon on the seas, keeping them relevant in the modern day. You won't have the convenience of international travel in a single day, but at least you get to pass impressive looking battleships on your cruise liner as you travel between countries.
3) No Submarines. If you have no stealthy way to get torpedoes close to large ships, then the battleship is still in with a chance. The fact that these can be built far cheaper than the ships they are designed to destroy makes them a real threat to the battleship in a combat situation.
One of the biggest issues with these ships was their cost, and when built governments were (ironically) reticent to use them in combat as it would greatly increase the risk of losing it. Ideally, changing all the above AND reducing the overall cost somehow of building large floating platforms of battleship size is needed because this class of warship was always prohibitively expensive to build. Missile destroyers etc. have provided a relatively cheaper way to get ranged attacks in play within a theatre of war, so without missiles you have more justification for the cost, but ultimately that is still going to be the limiting factor in the choice to build them.
The problem is, either aircraft or submarines/torpedoes will eventually render battleships useless. They do this by being able to kill a battleship while costing much less. If a billion dollar battleship can be sunk at the cost of a \$10 million aircraft or \$100 million submarine, a battleship is no longer a useful weapon of war. There is basically no way to escape this calculus, and there is no way to "advance" to anything like a 21st century without aircraft or submarines becoming technologically practical.
However, the knowledge that aircraft and submarines have superceded battleships would not be acquired without a war. Imagine that WWII was never fought. Navies at the beginning of WWII had some aircraft carriers and submarines, but they also considered the battleship to be backbone of the naval fighting force. It wasn't until the first year or two of war that this knowledge became commonplace. The power of submarines was demonstrated by the sinking of Courageous and Royal Oak in fall of 1940. The Bismark was sunk by aircraft (primarily) in May 1941; and the effectiveness of airpower was firmly demonstrated by the sinking of Prince of Wales and Repulse immediately after Pearl Harbor.
If you remove the knowledge that aircraft and submarines can easily sink battleships for a low cost, then it it might be reasonable to keep on building battleships up until the next war. If that war didn't happen until the 21st century, then so be it.
Besides, if battleships are not proven obsolete until the 21st century, then it might turn out that modern technology has made them un-obsolete by the time the next war rolls around, as proposed in other answers.
This is easier than all other solutions. You have to understand why Navies had Carriers going into World War II in the first place: The 1922 Washington Naval Treaty.
One of the possible causes for World War I was an Arms race to build battleships, which fuelled the eagerness to fight it... It was pretty much a prequel to the Cold War only the weapon was not capable of destroying the world many times over. At the end, the five biggest naval powers at the time (Britain, US, Japan, France, and Italy, from largest to smallest) met in Washington D.C. to negotiate a treaty to limit the tonnage of ships in their Navies. As this was in the United States, the U.S. was the big winner of the treaty as they were able to spy on all the other delegations and get their terms. The United States had too big war concerns in the future... both of whom were at the table no less: The British, because we hadn't had a war with them and all their biggest foreign wars were with the British prior to World War I. But at this point in history, the U.S. and the British had more in common military policy than conflict points... Japan was a different matter as they had territorial aspirations in the Pacific Ocean AND had a history of punching above their weight class that could not be ignored. Not to mention they had much more points of contention that could lead to military conflict (and as we know, did). The U.S. really wanted to screw the Japanese over and they had cracked their codes so thoroughly that they know the bare minimum Japan would accept in the treaty. They then bid under that number, Japan got upset, the U.S. would him and hall about maybe coming up to the minimum acceptable numbers, and Japan would be tricked into taking the lower figure because they needed the Treaty too.
Japan at the time also saw the United States as their next big military target and wanted the Treaty of Washington in place to restrict the U.S.'s superior manufacturing capabilities. However, because of the hard bargain the U.S. Drove, the Treaty was very unpopular in Japan, especially among the navy. It should be pointed out, that the admiral who would plan Pearl Harbor did defend the treaty because it was better that they were restricted a little if the U.S. was restricted a lot. And Japan did get some nice bonuses from their efforts. The target of the treaty was limiting Battleships, so everyone was fine with Japan's then construction of the Hosho which was the first purpose ordered Air Craft carrier, was classified as an experimental class, which meant it did not count to tonnage. In addition, while the Treaty called for total scrapping of all battleships in production, Japan was able to convert some already laid hulls to carriers that were technically larger than the treaty permitted carriers to be as a concession. Additionally, the treaty only affected carriers above 10,000 tons. Anything under was designated as a light carrier and was not limited in number. This might not seem like much, but "Treaty Ships" were rampart among all signatories... basically these were ships that were built with either new technologies, mis-measured, or outright cheated to meet qualifications of another ship style to avoid treaty limitations. All of these were seen as acceptable terms by the U.S. because they were more concerned with Battleships than the were with carriers. But Japan realized that if they could perfect carrier operations, they could still have and effective war platform. In 1934, 3 years into the Second Sino-Japanese War, Japan signalled it's intent to withdraw from the Treaty and did so in 1936. No longer limited by the treaty, Japan would build more ships to the point that in 1941, they had a fleet of 10 carriers, which was equal in number to their battleships. As the U.S. embargoed oil to limit the Japanese War machine in China (following an incident of intentionally firing upon a U.S. Ship in the area) Japan drew up plans to shock the United States into concessions. Hoping for a similar victory to Russo-Japanese war, where the sudden attacks forced the stronger Russia into suing for peace, the Japanese hoped that a few quick hits against the U.S. and Great Britain to demoralize the U.S. and make a quick but winnable war. Knowing that both nations were still operating on Battleship Theory, while Japan had been developing Carrier theory, they elected to put make their initial attack a Carrier based attack, as the United States would be much more wary of Battleship movements.
On December 7, 1941, without warning, naval combat was changed forever and battleship theory was rendered obsolete. It wasn't just Pearl harbor. Simultaneously (but across the Date line, so really on December 8) the HMS Prince of Wales and HMS Repulse, the first time an Ariel attack sunk battle ships underway. The attack was devastating to the capital ships of the U.S. Pacific fleet. A full 2/3rds of all capital ships were put out with a quarter complete losses. Of the four remaining capital ships not damaged enough to be removed from active service, 3 were aircraft carriers that were not in port during the attack and the U.S. Pennsylvania was the lone Battleship that could be put to sea. The remaining 8 were lost, sunk, or two damaged to be put to sea without major repairs.
Although Battleships would be important Naval weapon for years to come, with the last U.S. battleship to sever, the U.S. Missouri, seeing combat in the Gulf War, No new Battleships were made following WWII, with only four surviving the conflict. Two more Death Knells would sound for the Battleship Theory during WWII: Six months after Pearl Harbor, the Battle of Midway would see the sinking of 4 of the six carriers that attacked Pearl Harbor without either combatant fleet having sight of each other. The final nail in the Battleship's coffin would come from the sinking of the Yamato in 1945. Perhaps the most feared Battleship to ever sail, the U.S.'s initial plans were to sink one ship in battle with a fleet: Six Battle Ships, Seven Cruisers, and 21 destroyers were sent to intercept the ship... but the Carrier U.S.S. San Jacinto was ultimately sent in first. It took less than two hours for the single escort carrier to down the mightiest battle ship with only six bombs and 11 torpedoes... a feat that required a fleet's worth of battleships to achieve.
The Pacific Theater of WWII largely changed naval warfare forever. Carriers gave the Dreadnoughts something to dread... and they did very much. While the Yamato did help sink an another Escort carrier in an earlier battle, fears that it had actually hit one of a many fleet carriers forced it to turn around as it could not compete with the largest carriers. There is no technological innovation by this point that would have protected battleship from the damage a carrier could wield. Carrier's weapons had a greater range, and were not critical to the ship. However, the Carrier was born not out of a fear of a second Arms Race of Battleships and in an effort to reduce arms of the biggest naval powers AND screw their biggest rival, the Japanese responded by producing a devastating weapon. Without the Treaty of Washington's success in restricting Battleships, the Carrier would be seen largely as a toy to be played with than the deadliest combat ship of the modern era.
Battleships mainly went out because high speed, long range attack vectors became available that could deliver massive damage that such ships could survive as long as damage from any other source but couldn't respond to effectively. This mainly consisted in munitions delivered by combat aircraft, a world in which the Hunter, Kroll and Bayer processes were never perfected would have very little light weight alloy available. That makes long range aircraft, and naval aviation, possible only once strong composite materials, like carbon fibre, become available and even then operational ceilings are relatively low due to the stiffness of such composites compared to modern metallurgical products, this limits range and carrying capacity. Without light weight aluminium and titanium missiles are also relatively limited in range and payload so they're also less of a danger to ships at sea. Submarine attacks are still more of a danger to a classic battleship than attacks by surface ships but that's primarily an issue of having weaponry that can retaliate against subsurface targets added to battleships which it wasn't historically because they weren't designed for it not because they couldn't be designed for it.
This is a bit tricky. The dominance of the Aircraft carrier comes from its ability to extend air superiority over a huge and movable region for a very long period of time. Whoever controls the sky will dominate the battle because it carries such a huge advantage. To remove the dominance of Aircraft carriers, you need to either have a superior Air force or have someway to effectively remove aircraft carriers before they can get into range.
The easiest way, would be to simply create a world with a stunted Airforce or where flying technology isn't as well developed. This will remove the main advantage of an Aircraft Carrier making battleships awesome again.
The next way would be to limit fuel. An Aircraft Carrier needs to carry fuel for itself and for all the planes on it. It needs to be deployed for long periods of time ( no sense in requiring it to dock at a friendly port every day/week) to take full advantage of its aerial support. Limiting this would limit the use of Aircraft carriers. You would need other methods to establish a safe port to allow the Aircraft carrier to refuel and its operation range would become very limited as it would require the use of a base nearby to constantly fuel it. Limiting fuel would of course also limit your Air Force and Mechanized unit.
Other than that, you could focus on extremely long range rockets, which would be able to easily destroy Aircraft carriers, making the investment in them not worth it as long range bombardments become the weapon of choice, or have extremely good submarine technology so that Aircraft carriers are always susceptible to being destroyed and again no longer worth the risk.
First, you'd have to remove torpedo bombers. More generally, you'd want to ensure that planes could not practically destroy large surface ships, such as battleships or other carriers. You can't practically reduce a carrier's range without axing civilian and transport aviation too, but you can defang them. Reconnaissance alone would probably be enough to ensure carriers were still part of the fleet - not to mention their ability to harass an enemy at long range, albeit with lesser firepower. (In WW2, ships weren't often taken out at a single stroke; repair efforts would continue well after the battle, and could prove decisive in whether the ship was recovered or lost. A handful of bombs wouldn't likely sink a battleship, but could hinder repairs or cripple a supporting tender.)
Second, you have to keep aircraft defanged. Guided missiles will make battleships obsolete whether carriers can launch them or not, so you need to keep those off the table. Submarines are also a potential problem, although they have to get closer than guided missile destroyers and so will be easier to deal with. Interestingly, anti-submarine work is a big part of naval aviation even as it stands; in this world, where carriers aren't the bulk of the firepower, I would expect ASW to be a bigger and bigger part of their job as submarines get better.
Third, you have to make battleships worthwhile in comparison with ordinary, non-missile cruisers. The reason torpedoes and missiles spelled the end of battleships wasn't just range, but that it became impractical to mount any kind of effective armor against them. If a torpedo will sink a battleship as surely as a destroyer, there's no point to building one battleship when you could have 20 destroyers instead. But the same holds true if guns develop to that point. You have to make sure that your armor can still blunt the enemy's firepower or else ships will inevitably decrease in size.
No simultaneously compact and powerful engines, including specifically:
- No internal combustion engines
- No rocket engines
- No Stirling engines
- No high-density batteries.
You could still have nuclear, which would be great for battleships, as long as the lack of batteries or other suitable engines for torpedoes doesn't result in useful nuclear attack submarines.
Preserving this one is difficult: There's about a dozen ways to sink a battleship with modern technology without much defense against it. They were doomed from several sides at once. From the surface, destroyers were already sinking battleships with torpedoes. So you need to get rid of those.
From the below, submarines in WWII didn't quite get there, but a modern diesel-electric would send even the most powerful battleship fleet to the bottom. And they're so quiet that surface-based ASW escorts only offer some chance of thinning the pack, not preventing the attack.
The most obvious threat is air - and without internal combustion, you don't get decent aircraft. You'd get small spotters and such, short-ranged strikes, but not the kind of powerhouses they became in WWII. Bombers could destroy battleships with torpedoes, bombs, or rockets - plenty of choice there.
Finally, guided missiles were the nail in the battleships' coffin. Today, a battleship without carrier escort can be destroyed without even knowing it, with a long-range missile strike from a bomber.
If you are to have old-school battleships, guns and armor, you can't have torpedoes, bombs, guided missiles, or effective submarines. The only means to avoid that is to take away their engines. Of course, this will also have an effect on some other things we take for granted, like cars...
So what to do if you want to have battleships in the 21st century in your story, but not have your story turn into a Space Battleship Yamato fairy tale?
"No gun battleships" doesn't mean you can't have battleships, they just won't be the same. One take on that is a "very large cruiser" with active defenses instead of passive ones.
There's really a whole board on NavWeaps dedicated to the idea of reviving battleships, and you'll get far more information there. To offer some best pickings, here is a very down-to earth take on a 21st century battleship.
Assuming we can do a little bit of fiction here, the biggest problems with battleships can be solved with a little bit of handwaviness that makes the science-fiction world go round: shields.
See, battleships have huge profiles, are big targets, are not agile enough to evade incoming fire. Assuming you upgrade the anti-air to the point that you could hit aircraft at their maximum envelope, had EMwarfare packages that could screw with incoming missiles, and you had some kind of EM-shielding or kinetic force field barriers to stop incoming kinetic and energy weapons of a low yield, the battleship becomes a floating railgun boat, which, in this theoretical science fiction version of modern day, might be the only thing with enough punch to get through these shields, and of course would be more than enough medicine for anything smaller.
That would mostly put battleships back at the apex. Smaller vehicles and craft could have shields, but they'd be weaker, probably only effective against other craft in their class. And railgun projectiles move too fast to easily dodge. The ability to have a huge powerplant to run the thick shielding gives battleships their edge.
The fix for your problem is more than doctrinal. Needs new tech.
A lot of answers focus on the air vs sea inequality, which is only a small part of why battleships went out of use.
A much larger part was the discovery that the cavitation from an under-keel explosion (see page 13 for a good quote) was destructive to even the most heavily armored ships. Much more destructive than a direct hit. A single torpedo could significantly damage and potentially incapacitate any ship, no matter how thick it's armor, by causing lots of small fractures and injuring the crew. This means that ships needed protection from submarines and explosive projectiles, because a single hit could be fatal. Aircraft and cruiser escorts became mandatory to create a "safe zone" around the important ships, both to spot submarines and to spot enemy combat groups before they spotted you so the enemy could never get the first - and potentially fatal - shot before you could shoot back or evade. Ships started to have less armor and instead range and speed became the deciding factors. If it wasn't for carriers, cruiser fleets would have replaced battleships, because smaller and faster ships are less vulnerable against cavitation hits than big, lumbering ships.
To keep battleships relevant, you'd not only need to remove the threat of aircraft, for which others wrote suggestions, but also the threat of submarines as well as prevent someone from figuring out the cavitation effect.
Submarines can be hampered by a lack of effective sonar, which could be explained by failed experiments, failed funding or researchers going down the wrong road and getting stuck with something ineffective, e.g. sub-surface radar.
To prevent someone from discovering the cavitation effect, you could turn technology forward at the right points in time, and have armor piercing shaped charges discovered and used earlier than in actual history, which makes explosions below ships slightly less dangerous.
- Battleship reach: why can't it carry missiles? I mean, during Gulf War battleships did lop a few cruise missiles. They can carry quite a lot of them, more than an aircraft carrier of the same size.
- Smart weapons: solar powered drones and even balloon ones can hover about for days on end way away from the battleship listening and providing targets and even attacking potential baddies. They can even land on water and listen to what is below it. Big ship can carry big loads, meaning you have now an early warning/countermeasure systems.
- Lots of power: if you have electrically-powered guns (railguns come to mind), you can power big ones in a battleship. One nuclear reactor is not good enough? Throw in another one, so you can even run on one while doing maintenance, or powering the big party on the cruise ship you just rescued.
- (as other mentioned) lots of space to put smarts and smart defenses. Yes, computers are getting smaller and smaller but a battleship has enough room to shove an entire AWS datacenter, meaning enough to do all the deep learning to help find out baddies and give them the finger before they get close to you. In plain English, the computing power you can shove into a battleship is more than you can shove into a plane. Now you have something of the size of a small city packed with weapons able to detect a plane hundreds of miles away (remember the drones). Things get a bit different.
- Big guns. Big dumb guns. I do not think we have the technology today to stop a shell about as large as a car flying towards us. It is like trying to stop a big rock falling from the sky. Best you can hope for it so send a missile that will hopefully veer it off just enough to miss you. But it is still coming down.
- Psychological warfare: if the battleship can stop the attacks launches by aircraft and is fast enough, it now can get close to where those aircrafts came from. And now, it can use its big guns to do big damage (the other weapons would probably be blocked the same way the battleship stopped being attacked). It would be a really bad day to be on the aircraft carrier/destroyer/base on the receiving end of those big rounds.
I'll cover some points already made and some new ones.
Battleships can remain on the sea's in the (partially combined) cases of:
- Expensiveness of the Battleship's replacements. If the things like fuel and construction of aircraft and missiles is much more expensive due to lack of industrial capacity or technological know-how for proper/cheap refinement their coming will not immediately end Battleships, they'll become an expensive alternative.
- The great Fuck Up. Many technologies are held back years because of a single decision or event. If due to mismanagement, inexperience or sheer coincidence a grand air/missile attack fails spectacularily and this news reaches across the world then the advent of air and missile power could be stalled as no one is willing to invest in it. Alternatively if Battleships manage to sink some aircraft carriers in the early days (again, due to mismanagement, inexperience or sheer coincidence) the faith in these new technologies may plummet as well.
- Lack of Funding. History is filled with incidences where a promising technology isn't pursued because the tried and true methods get more research and funding first. This can easily go hand-in-hand with an Old Guard in command influencing decisionmaking and steering towards tried-and-true methods rather than new technologies like aircraft and missiles.
- Lack of small computers. Missiles are just rockets if they don't have the computers on board to steer themselves towards a target. This makes over-the-horizon combat much less effecient compared to just lobbing shells at each other, especially considering the expenses and travel time a rocket has to the target.
- Ship-based ECM research moves faster than rocketry and aviation. If a ship can reduce the chance it's hit by a missile or aircraft to practically zero then the Battleships will remain viable.
- Ship armor improves faster than effective missile and aircraft weaponry. If it takes so much missiles and aircraft weaponry to down a Battleship that it has time to get in range of the aircraft/missile carrier and fire it's high rate of shells to defeat the aircraft/missile carrier first then battleships have a purpose still.
Keep in mind that while some are pretty weak on their own (like ship armor improving faster) if combined with other points they can become a solid reason. Say ship armor improving fast while missile research and materials are much slower causing them to cost way more and take much more time to build individually means that Battleships are a much more reliable source of firepower on the sea's even though they run a high risk of missile strike from the few but highly expensive aircraft/missile carriers. But that's what smaller ships can help against in this scenario as small ships would no longer be a viable target for missile strikes due to cost/effectiveness, allowing them to help in missile and air defense.
I don't think you even can eliminate carriers or make them irrelevant.
The existing answers are all very good and show that a battleship could retain its superiority over a carrier in a battle - keeping it very relevant. However, outside of making planes implausibly bad (due to fuel, AA or whatever), carriers will be also important, usually even more important than battleships. Currently the biggest point of carriers is range of power projection. Battleships could perhaps dominate 50 km while carriers strike 500 km away.
If you consider say USA-USSR conflict, battleships could be deployed to protect and attack important cities on or the coast. Both sides would require them to survive naval battle. But to strike further inland, you have to use planes - so both sides also need carriers. So far it is looking quite rosy for the good old battleship.
But suppose proxy war (USA attacks weak USSR ally or vice versa) or USA/USSR terrorizing a small country. Sure, a battleship can easily wipe small enemy fleet and coastal defenses. But so can a carrier - considering lack of serious opposition. But a battleship cannot take care of recon, nor fortifications deep within enemy territory. Also, carriers will be gone before battleships even approach them.
Therefore, carrier development will be incredibly important and I believe it would be the most important ship for involved countries, even if its might doesn't quite match a battleship.
But what might happen from now on? Lasers could develop to be excellent to take down missiles or airplanes - make a tiny hole to set off explosive. Only the primitive big chunk of steel would work reasonably well (nothing to explode, too much material to vaporize it all). So, battleships and their guns.
This is essentially the same as "make AA implausibly good", but I feel it is more realistic now than it was in the past.
As a short and simple fix, there need to have been no major wars after WWI, and thus no naval combat involving capital ships. It takes a war to overturn an embedded doctrine such as the superiority of the battleship, and with no wars, battleships will remain the fleet flagships rather than carriers, despite the junior officers and experts who point out how vulnerable they would theoretically be to aircraft, missiles and torpedoes. Arguably, the same thing is happening now, and carriers should be obsolete because of their vulnerability to swarms of small surface craft.
Peacetime Navies are normally conservative institutions that are adverse to developing revolutionary new weapons systems. If the WW2 Pacific conflict had never happened, it's likely that battleships would have been around for a lot longer and large carriers would have taken more time to appear.
Even after WW2 though, the case that battleships were obsolete is overstated. The main reason the United States Navy didn't build battleships after WW2 is because there were no enemy battleship fleets left in the world to counter. The battleships themselves were still a threat and remained so at least until aircraft could be relied upon to take off and fight at night and in any weather (this probably happens in the late 1950's).
For example, if the Soviets has chosen to build a battleship fleet during the early stages of the Cold War (they had plans to do this but didn't follow through) then it's very likely the United States and Great Britain would have built new battleship fleets to match them.
It's also worth noting that even today most Navies don't build large carriers. The United States Navy, with its mission of "Global Power Projection", is a special case. For most Navies carriers are far too expensive and as they only plan to fight close to home they can rely on land based aircraft. So perhaps, if there is no there is no global super power in your story, but only regional powers, then there might be fewer carriers.
In some ways battleships are still with us as ship size classifications have undergone significant inflation over time. A modern day destroyer for example is of a similar size to an early WW1 battleship and some big cruisers are as big as a WW2 battleship (although without armour they are only about half as heavy) .
If you specifically want to have big ships with heavy amour and large caliber guns then it's difficult to see them still providing the main fighting power of a fleet into the 21st Century. Guns lack the range and guidance capabilities of missiles, and armour is practically useless against torpedoes and mines (when an explosion occurs underneath a ship, the weight of the vessel acts against itself to break the ship in two).
However it's not inconceivable that in you world submarines, torpedoes and mines have been banned or heavily restricted by arms limitation treaties (some people actually did want to ban submarines then they first appeared as they were seen as being an "underhand" way of fighting). There have certainly been naval arms limitation treaties in the past, and even during the Cold War, there were certain types of weapons that both sides refrained from building, even though they would have been very useful - e.g. spaced based missile systems. Perhaps with this treaty in force you'd have big capital ships with enormous missile batteries that could also conceivably have armour as well as active anti missile defenses. Maybe later on in the 21st Century they would have electromagnetic rail guns.
The biggest threat to modern naval warfare is arguably new-generation anti-ship missiles.
Here are several examples of pain-in-the-behind missile tech that could easily bedevil military ships for decades:
- Hypersonic missiles. Ouch. Nearly impossible to intercept with anything other than a laser, and they will punch a hole in the hull and the pieces will probably go out the opposite side. Better hope they don't come in a swarm and overload the antimissile battery either. Even a laser isn't guaranteed to stop them as the warhead can simply be replaced with an extremely dense weight equivalent that will impact around Mach 2-3.
- Missiles with nonstandard flight path that don't follow a ballistic parabola. This makes them extremely hard to intercept.
- Hybrid missile-torpedoes. Consider a missile that drops a torpedo into the water a certain distance from its intended recipient and continues to distract possible antimissile defenses. That would be especially nasty because the ship's crew will assume they shot down the missile and something fell out of it. About half an hour later, the torpedo blows a hole in the bottom of the ship and the crew are scrambling to figure out what happened.
- High-altitude dive missiles. These fly up and crash down hard on the target ship. Interception is of limited use as the pieces will rain down and cause damage at the speed they're moving. China is believed to be developing these as a counterbalance against U.S. naval superiority in the South China Sea region. An exceptionally nasty (and expensive variant) would make the dive missile a MIRV with a mix of dummy weights and warheads so the target ship has to deal with 10-12 smaller missiles of varying spec crashing down at Mach 3 right on top of it.
The only way I can see modern naval combat surviving (without banning missiles) is to go underwater, or develop a new generation of armor that thwarts missile attacks. I've been seeing an increasing number of new articles where navy engineers mull new-generation submarines that carry a mix of drones and missiles.
Cruise missiles would have to evolve much faster. The first V2 would have to be deployed not in 1945 but in 1915, so that by the thirties some kind of guided or homing missile small enough to be carried in the battleships and destructive enough to sink most ships would be available. Also, if you can make cruise missiles you can make SAMs.
Your battleships will become huge missile cruisers, launching barrages of anti-ship missiles against other ships. Carriers would be destroyed because in a missile-saturated environment they are just floating gas stations waiting to be blown.