The kidneys have two main ways to maintain acid-base balance - their cells reabsorb bicarbonate HCO3− from the urine back to the blood and they secrete hydrogen H+ ions into the urine.
By adjusting the amounts reabsorbed and secreted, they balance the bloodstream’s pH.
Our kidneys filter blood continuously by distributing the blood that comes into the kidney to millions of tiny functional units called nephrons.
Each nephron is made up of the glomerulus, or a tiny clump of capillaries, where blood filtration begins.
When blood passes through a glomerulus, about one-fifth of the plasma leaves the glomerular capillaries and goes into the renal tubule.
Reabsorption of the good stuff---water and electrolytes---and leaving behind the bad stuff---waste products and acid--- is the job of the the renal tubular system.
The renal tubule is a structure with several segments: the proximal convoluted tubule, the U- shaped loop of Henle with a thin descending and a thick ascending limb, and the distal convoluted tubule, which winds and twists back up again, before emptying into the collecting duct, which collects the final urine.
Each of these tubules is lined by brush border cells which have two surfaces.
One is the apical surface that faces the tubular lumen and is lined with microvilli, which are tiny little projections that increase the cell’s surface area to help with solute reabsorption.
The other is the basolateral surface, which faces the peritubular capillaries, which run alongside the nephron.
So with bicarbonate reabsorption, as the filtrate leaves the glomerulus, it first goes through the proximal convoluted tubule.
Now at first, this filtrate contains the same concentration of electrolytes as the plasma it came from. But when a molecule of bicarbonate approaches the apical surface of the brush border cell it binds to hydrogen H+ secreted by the brush border cell in exchange for a sodium ion from the tubule to form carbonic acid.
At that point, an enzyme called carbonic anhydrase type 4 which lurks in the tubule in the microvilli like a shark, swims along and splits the carbonic acid into water and carbon dioxide.
Unlike charged bicarbonate anions, which are stuck in the tubule, the water and carbon dioxide happily diffuse across the membrane into the cells where carbonic anhydrase type 2 facilitates the reverse reaction - combining them to form carbonic acid, which dissolves into bicarbonate and hydrogen.