There are numerous opportunities for studying online these days and many schools say they can offer a degree. Many of these schools call themselves universities and you will automatically assume that they are accredited and that you can just enroll in their courses and obtain a valid university degree without going through all the hassle of actually being a student.
Unfortunately all this is just a mirage, most of the time anyway. In order to have a valid university degree you need to get it from a university that is accredited by one of the six regional accreditors in higher education accreditation in the United States. You can easily check this for each of the universities you are interested in and you will often find that most of them are not accredited.
Most online so-called universities are just private companies that offer courses on certain subject and they are very good at it and you can use the skill you acquire successfully, but you may not be able to use that degree in an official context somewhere. That only matters in certain cases, so you don`t have to renounce your studies just because you will not get an accredited diploma. The thing is that there are few university degrees that are recognized worldwide. Many students from abroad have this problem. They study at home in a perfectly valid and recognized university, but then they are rejected at bigger universities in other countries or in the States.
You generally need a valid university degree in order to continue your studies and enroll in other universities and courses. Just to be safe you should always check the university that is offering the courses to see if it is accredited and some online universities are accredited, because they are part of a brick and mortar established University that is accredited.
So in order to get a valid online university degree you need to go to the online versions of traditional universities and still ask every time if the degree that you will receive is in fact accredited and where is that accreditation valuable. Take note that sometimes accredited universities lose their accreditation and so does your degree or diploma.