Sodium and potassium ion batteries hold promise for next-generation energy storage systems due to their rich abundance and low cost, but are facing great challenges in optimum electrode materials for actual applications. Here, ultrathin nanoribbons of sodium titanate (M-NTO, NaTi1.5O8.3) and potassium titanate (M-KTO, K2Ti4O9) were successfully synthesized by simultaneous oxidation and alkalization process of Ti3C2 MXene. Benefiting from the suitable interlayer spacing (0.90 nm for M-NTO, 0.93nm for M-KTO), ultrathin thickness (<11 nm), narrow widths of nanoribbons (<60 nm), and open macroporous nanostructures for enhanced ion insertion/extraction kinetics, the resulting M-NTO exhibited a large reversible capacity of 191 mAh g-1 at 200 mA g-1 for sodium storage, higher than those of pristine Ti3C2 (178 mAh g-1) and commercial TiC derivatives (86 mAh g-1). Notably, M-KTO displayed superior reversible capacity of 151 mAh g-1 at 50 mA g-1, 88 mAh g-1 at a high rate of 300 mA g-1, and long-term stable cyclability over 900 times, which outperform other Ti-based layered materials reported to date. Moreover, this strategy is facial and highly flexible, and can be extended for preparing a large number of MXene derived materials, from 60+ group of MAX phases, for various applications such as supercapacitors, batteries, and electrocatalysis.