CBS Inc. today confirmed its purchase of Ideal Toy Corp., a merger that will cost as much as $58 million and will double the size of CBS's toy operation.

Ideal manufactures dolls, toy vehicles and puzzles--including Rubik's cube--while CBS owns the Gabriel Industries toy lines, including Erector and Tinkertoy sets and Othello games. Their combined sales would make CBS about the fifth-leading toy maker.

CBS officials said the transaction puts CBS in direct competition with major international toy makers in the growing $5-billion-a-year industry that is bigger than any CBS is now in other than broadcasting.

The $5 billion figure does not include what is at least a $1 billion market for video and computer games, a field that CBS moved into substantially this week by signing a licensing agreement with Bally Manufacturing Corp.

In addition, the merger will allow CBS to take advantage of Ideal's substantial international distribution operations, as well as to assume an underutilized, one-million-square-foot plant in Newark, N.J., according to Thomas M. Kirwan, president of CBS-Columbia, the division that includes the toy operation.

The two companies still must sign a definitive agreement, which will have to be approved by their boards of directors and shareholders and by federal antitrust officials.

CBS offered $14.85 a share for Ideal stock, and there are more than 3.86 million Ideal shares outstanding. Trading in Ideal stock was halted yesterday at 12 5/8 a share, and it closed today at 13 3/8, up 3/4. Three Ideal stockholders already have agreed to vote 16.1 percent of the company's outstanding stock in favor of the merger.