How to create shortcode in wordpress

Write this below code in your activated theme functions.php file. Here we are creating the [shortcode].

add_shortcode('shortcode', 'shortcode_cb');
function shortcode_cb() {
    ob_start();
    ?>
   Your html goes here...
        <?php
        $shortcode_data = ob_get_clean();
        return $shortcode_data;
    }
}