You can use a function get_categories for this
This function Returns an array of category objects matching the query parameters.
Arguments are pretty much the same as wp_list_categories and can be passed as either array or in query syntax.
in short you can use this snippet
<?php
foreach((get_categories()) as $category) {
echo “<li>”.$category->name .”</li>”;
}
?>
note # make sure that atleast one post is present in all of the categories