Obsessive-compulsive disorder (OCD) is a mental illness that causes repeated unwanted thoughts or sensations (obsessions) or the urge to do something over and over again (compulsions). Some people can have both obsessions and compulsions. OCD isn't about habits like biting your nails or thinking negative thoughts.