British Malaya (18th century-1946), a loose collection of British controlled states in the Malay Peninsula, consisted of the Crown colony of the Straits Settlements (which included Singapore) and the protected states known as the Malay states (divided into the Federated Malay States and the Unfederated Malay States).
In Singapore law, Malaya means the States of Malaya (also known as Peninsular Malaysia) together with Singapore (1946-present).
The Malayan Union (1946-1948) was a post-war British colony consisting of all states in British Malaya except Singapore. The Federation of Malaya (1948-1963) was the successor of the Malayan Union (also excluding Singapore), which gained independence within the Commonwealth of Nations in 1957. Present-day Peninsular Malaysia (1963-present), also formally known as the States of Malaya, includes the states and territories formerly composing the Federation of Malaya.