If your iPhone is locked, you will not be able to factory reset it without the passcode. If you don't know the passcode, you will need to contact Apple for support.