The 34-year-old Poland international, who was out of contract at Liverpool, has passed a medical at the club's Valdebebes training complex, and has signed a two-year deal.
Dudek - who had spoken publicly of the move for some time - will be the back-up to Spain goalkeeper Iker Casillas, after Diego Lopez moved to Villarreal. Dudek had played for Liverpool since 2001 after moving from Feyenoord, and hit the headlines when his 'rubber legs' penalty saves helped the side beat Milan in the Champions League final in Istanbul in 2005.
However, some high-profile errors - particularly against bitter rivals Manchester United - moved boss Rafa Benitez to bring in Pepe Reina from Villarreal, who held onto the number one shirt ahead of Dudek for the last two seasons.
Dudek becomes Real's fourth signing of the close season after defenders Christoph Metzelder and Pepe, and Argentine striker Javier Saviola.
Elsewhere in Spain, Athletic Bilbao striker Ismael Urzaiz has joine dAjax on a one-year deal.
Ajax coach Henk ten Cate told the Dutch club's website: "He's a good striker he can head well, protect the ball.
"He's a welcome addition to the squad who can help us when we are having trouble breaking down a defense."
The 35-year-old forward ends his 11-year stay at the club, during which time he scored 116 goals in 367 matches.