Outside the Church there is no salvation

‘Outside the church there is no salvation’ is a very old phrase and comes from the writings of early Christian thinkers. This phrase expresses the belief that only Catholics will go to heaven. 

Re-formulated positively, it means salvation from Christ the Head, through the church which is his body

Catechism

This statement echoes Jesus’ own words:

I am the way, the truth and the life; no one comes to the Father but by me’ 

John 14:6

The way you can be most certain of receiving salvation is to be baptised and a practising member of the Catholic church. 

Jesus said 

He who believes and is baptized will be saved

Mark 16:16

However, it also teaches that the Church of Christ is wider than the Catholic church.

Catholics believe that the full way to get to God is through the Catholic faith but God is bigger than the Church so people who are not Catholics can be saved by Gods power.

People who have not heard the Gospel of Jesus but have lived good lives can be saved because it is not their fault that they are not Christians. They are sometimes referred to as ‘anonymous Christians’ or ‘accidental Christians’. This is because they are living lives that follow the example of Jesus without realising it. So the Church believes that people who are not Christians can also be saved.

Those who, no fault of their own, do not know of the Gospel of Christ, but nevertheless seek God with a sincere heart, may achieve eternal salvation

Lumen Gentium