Stopping a rigidbody immediately

I’m very new to Unity and C#. I have a cube rigidbody that I am trying to stop once I release a movement key(WASD, etc). However, when I release the key the cube slides just a bit and that is what I am trying to prevent. I have maxed mass, velocity, material physics, and all in between with no success.

private Rigidbody rb;
private float moveHorizontal;
private float moveVertical;

public float maxSpeed = 10;

// Use this for initialization
void Start () {

    rb = GetComponent<Rigidbody>();
    moveHorizontal = 0f;
    moveVertical = 0f;

// Update is called once per frame
void FixedUpdate () {

    moveHorizontal = Input.GetAxis("Horizontal") * -maxSpeed;
    moveVertical = Input.GetAxis("Vertical") * -maxSpeed;
    rb.AddForce(moveHorizontal, 0, moveVertical, ForceMode.VelocityChange);

    //Limit Speed
    if (rb.velocity.magnitude > maxSpeed)
        rb.velocity = rb.velocity.normalized * maxSpeed;

   //Stop Movement
    if (Input.GetAxis("Horizontal") == 0f && Input.GetAxis("Vertical") == 0f)
        rb.velocity =;
        rb.angularVelocity =;

@quazeryon After some more research (and quite a few trial and errors) I tried GetAxisRaw(); and that seemed to do the trick.

check the input options, the axis should have a “gravity” which defines how fast the values are set to 0. If you increase this value, you should be able to stop the moving body once you release the key.